Program download via 5150CAXX cassette interface

5150CAXX running under emulated 64K IBM PC rev. A. Command line options are pretty self explanatory.

The very first IBM personal computer, the IBM 5150 – which was a business-oriented machine, came with built-in cassette port… Too bad it could only be used through cassette BASICcontained in the ROM … Or, on the contrary, thank God? Yes, this interface was soon dropped for obvious reasons. But let’s fast forward 40 years: revive this legendary machine, and why don’t we try the cassette interface … in DOS?

Since DOS itself did not have any support to work with an interface like you see, this utility allows you to access the IBM cassette port directly alongside DOS in order to read and write raw data: whether original IBM BASIC applications or something else, using the cassette port on the IBM PC, right next to the keyboard connector. The program can also work with the infamous IBM PCjr … that is, if you can find (or make yourself) a cable for their patented connector marked “C” in someone else’s trash. Although ROM BASIC was on the successors of the IBM PC, the PC / XT and PC / AT did not have a cassette port. Thus, the program will not be able to boot on anything newer than an IBM PC or PCjr, for that matter.

Cassette port interface diagram

So how would you use this thing? First, as the name suggests, you need an original IBM 5150 PC or PCjr with DOS and a cassette deck. Or reel tape recorderwhich I used. Or, in general, any sound device capable of playing and recording … for example, a modern computer or even a smartphone.

You also need a suitable cable. In the case of the 5150, the problem is easily solved in accordance with the DIN pinout and the above diagram, similar to the Tandy TRS-80 data cable. Then you need to send the signals to your audio device, either mono or the left channel. Please note that if your device has a microphone rather than a line-in, you need to set it accordingly jumper P4 on the 5150 motherboard. Or alternatively, use a 1k resistor in series with your recorder’s mic input (which is what jumper P4 does internally anyway). Failure to do so may damage the microphone input.

DIN pins 1 and 3 on the 5150 are normally open relay contacts. Before any I / O operation, this relay actuates its contacts to turn on the cassette motor. If you are not using these pins, either listen for the click of the relay and power your device accordingly, or use the / A command line argument, which prompts and waits for you to hit PLAY (or PLAY + RECORD).

The application can be downloaded here… Or you can see the source code in my GitHub repos, however, you need the Turbo C compiler to compile it; ideally, the program is built with the BUILD.BAT batch script.

Note that the maximum sequential data that can be loaded from tape is always 64KB. This is a limitation for both real-mode addressing and BIOS tape I / O routines. Thus, IBM Cassette BASIC, which is in ROM, will not allow you to write BASIC scripts larger than 64 kilobytes. Also note that if you do not have enough memory (early motherboards 16-64KB), this value may be even lower.

5150CAXX on IBM 5150 with reel tape recorder Tesla

Command line options are now easy to understand. You need to locate the tape in the right place and then use the / R, / D, or / X commands to read from the tape to save it to a file, display it as raw ASCII, or read the data as machine code, respectively. Anything read from the tape is in no way “parsed” to save the interface, so there is no special “LOAD” command to find user application / data / whatever.

Although specifying the number of bytes to read is optional, it is recommended that you write it down and always specify it after the read command. Otherwise, the 5150CAXX does not know how large the data stream will be read from the tape, and so it will continue reading until it reaches a “bad tape signal” or CRC error, stopping the reading.

In this case, the size of the output file may be slightly larger, as the BIOS ROM may add zeros or corrupted data after the end of the actual data stream. This is because the read continues after a valid stream, and this now invalid read operation eventually fails on the CRC / sync block, stopping the tape. In this case, you can either strip out the extra bytes with a HEX editor, or ignore them altogether. See the picture below.

Also note that if you are using a real tape recorder and receive CRC errors or “bad tape signals” and only some of the data is written (or read) correctly, make sure that both the recording modulation and playback volume levels are high enough and not distorted. , there is no audible tape drop, the heads are intact, the recording offset is correctly set, and there is absolutely no audible noise or vibration caused by mechanics or tape stretching. To rule out these factors for testing purposes, use a solid state sound source such as another computer or smartphone, etc.

Bytes that may appear at the end of the data stream if the size in bytes is not specified; However, the contents of the files are identical. Left window: original file, right window: file read from tape.

Back to the command line options, the / W command is used to load a given file from disk into memory, and then write it to tape at the current tape position.
Use / A to force the application to wait for your response, if you are not using a relay belt motor drive, for all commands.
The / X option is fine in its place because it interprets any data read directly as x86 machine code. Any incorrect instructions read from the tape will crash the system, requiring a reboot. Note that you cannot read BASIC applications this way: they must first be saved to a file and then interpreted with either IBM Disk Basic or Microsoft GW-BASIC, since they are not valid x86 instructions but are special format: “tokenized BASIC”.

An example of “Hello world” code that can be written to tape and read using the / X parameter can be found here. This code must be “conscious” and receive an instruction pointer for addressing, since it can be loaded almost anywhere in RAM like an old school computer virus. In addition, the code must end with a FAR RET (RETF) opcode to transfer control back to the operating system. See the example above for details.

Reading IBM Advanced Diagnostics from tape using 5150CAXX

Not much software was released for the IBM 5150 on cassette tape … apart from a few notable exceptions such as IBM PC Diagnostics and later IBM Advanced Diagnostics. Since the only way to run any 5150 application that is stored on tape is with IBM ROM BASIC (well, at least until the 5150CAXX was developed), this diagnostic package can be used to quickly check a PC without requiring any either disk or operating system.

Advanced Diagnostics Cassette Recorder essentially three parts, all of which can be dumped from the 5150CAXX into 3 files using the / R command three times. The first two parts are necessarily created by any application written in IBM Cassette BASIC and then saved using the SAVE command, and the third part is a bit special:

The first dump of a file is essentially 256-byte header of the subsequent data stream… It contains an eight-byte application identifier (in this case “ldcass”, the name you would normally give to the BASIC LOAD command), then the data stream type (labeled BASIC) and the memory location to load it.

The second dump of the file is a small BASIC stub that shows information about the diagnostic tape being loaded. This BASIC program cannot be run directly – you need to open it in GW-BASIC or IBM BASIC. It ends with a special CALL instruction that executes the third part.

Third file dump Is x86 machine code, which is a diagnostic application. It can be loaded directly using the / X option, or saved to a file and then using a small “auxiliary” DOS binary turn into a DOS application.

Using FASM and BUILD.BAT and renaming the third dump file to CASSETTE.BIN, the result is a DOS-compatible Advanced Diagnostics application that can be downloaded from here… Note that the exit procedure from this code is a reboot, since the application does not know that it is running in DOS.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *