Sunday, April 20, 2014

Tape Cassette Storage with the IBM PC and PCjr.

IBM include a 5-pin DIN cassette port in the IBM PC Model 5150.  This was intended for systems sold without floppy disk drives, which were still very expensive in 1981.  Until the PC was discontinued in 1987, you could still buy a 5150 from IBM without a floppy disk drive (Model 104).

The 5-pin DIN connector used a TRS-80 cassette cable to connect to a tape recorder deck.  The Radio Shack CCR-81 and 82 came with the cables and had both Mic and Aux input jacks.  IBM never made a cable for the PC, and the only software it ever supplied was IBM PC Diagnostics and Advanced Diagnostics.  Otherwise, use of the cassette port was intended solely for users of Cassette BASIC.  Cassette BASIC, built into the system, used its save and load commands to access the cassette drive.  In this IBM followed other 8-bit microcomputers of the day, as Cassette storage was the cheapest form of storage available for home computing.

When IBM released the XT, it removed the cassette port circuitry but kept Cassette BASIC in ROM for compatibility with Disk BASIC, Advanced BASIC (BASICA) and programs which relied on any of the three.  You could no longer save or load a program in Cassette BASIC.  However, IBM also used the same cassette interface logic for the PCjr.  This time, IBM released a cable to connect to the unique cassette port on the PCjr.

The IBM PC and PCjr. communicate with the cassette deck via Int 15.  At the low level, the audio coming from the deck to the system is digitized and read serially on bit 4 of the 8255 Port C.  Audio generated from the system to the deck is generated by 8253 Timer 2, which also controls the PC Speaker and then sent to the cassette.  The motor is controlled by bit 3 (and bit 4 in the PCjr) of the 8255 Port B.  The BIOS routine writes a 1 bit is with a tone of 1 millisecond (1000Hz), and a 0 bit with a tone of 0.5 millisecond (2000Hz).

To signal the beginning of a program to BASIC, there will be a "leader" of 256 bytes where all the bits are 1, followed by a 0-bit and then ASCII Hex 16.  Then a 256-byte data block will be written, followed by a 2-byte Cyclic Redundancy Check, and then more data + CRC blocks until the whole program has been written.  The maximum size that can be written is probably close to 64K, since that is the absolute maximum size of a BASIC program on the PC.

Typing SAVE"[program name] will save a BASIC program to the cassette.  Typing LOAD"[program name] in Cassette BASIC will instruct BASIC to start the cassette and search for the file.  It is up to the user to remember where the program is located.  If the system cannot "hear" a program, it will eventually quit trying and give the "Device Timeout" error message.  If there is some kind of problem with what it is trying to load, it will say "Device I/O Error."  You should keep the volume as high as possible when recording and playing back.

By using the cassette cable, you can record the output of the IBM PC's Speaker without any other adapter hardware.  You can of course plug the other end of the cable into a PC instead of a recording deck.  It is better to use the audio jack of the PCjr. to record sounds from it, as that jack can record from the PC Speaker, the 3-voice sound chip, the PCjr. Speech Attachment or the audio coming from the cassette.

Using the cassette port is may be a good method to record PC speaker music from a PC, but note that unlike the internal Speaker, the PC will generate a solid tone from the time it signals a system ready beep until software takes control of the PC Speaker.

One program that specifically supports the cassette port is Electronic Arts Music Construction Set.  This program has a setting to output 1 note PC Speaker or 4 note (tweaked) PC Speaker music, and has an option to output it to the internal PC Speaker or the cassette port.  4-voice output may sound better through a powered speaker than the internal speaker, but the basic sound will be the same.

One issue with the PC and PCjr. is that both support being connected to the Mic or Aux input of a tape deck.  The PC does so via a jumper on the system board near the PC Speaker header.  The jumper block is a 2x2 block.  If the jumper is placed across the pins closest to the M silkscreened on the board, then the audio will be sent at a level appropriate for a Mic Input.  If the jumper is placed across the pins closest to the A silkscreened on the board, then the audio will be sent at a level appropriate for a Line Input. The PCjr sends both the Mic and Aux input lines to the C connector, but the official cable only uses the Aux line. Some modern cassette recorders only come with a Mic Input.

No comments:

Post a Comment