5150: Setting up Tape Deck Connection (because the 5150 can)

MAIN 5150 REFERENCE

Last updated August 2021.

TABLE OF CONTENTS

  • Significance of the IBM PC 5150 Tape Support
  • History of IBM PC Cassette Software Support
  • Introduction to the Cassette Port of the IBM PC 5150
  • How to Encode a .COM to Tape Using 5150CAXX.EXE
  • How to Load a .COM that was Saved Using 5150CAXX
  • Using Python to Make Tape Loadable Binaries
  • EXAMPLE 1: Using ASCII (BASIC) [ asciiwrite.py ] to WAV
  • Saving WAV to Tape: Using TRS-80 Tape Deck (or similar)
  • To LOAD this ASCII (BASIC) file into IBM PC 5150 ROM BASIC
  • EXAMPLE 2: Using binary [ binwrite.py ] to WAV
  • To BLOAD this binary data or program using 5150 ROM BASIC
  • Playing BDASH and ARCHON from WAV (using smartphone)
  • Successful .COM to Tape Conversions
  • Back to BASICs

Special thanks to climatex, MasonGulu, retrohun for making the tools here that made all this possible.

NOTE: Click on photos for larger view.

Significance of the IBM PC 5150 Tape Support

One of the main unique aspects of the IBM PC is that it still has a tape connector. One technical reason for this is: during the development of the IBM PC, the disk drive interface and corresponding DOS hadn’t been developed yet. So for testing and development, engineers likely loaded programs using ROM BASIC via cassette tape, as a convenient way to exercise aspects of the system until the disk drive controller, drive, and DOS support all came together.

Even after the drive interface and DOS were available, the cassette tape interface also offered an inexpensive alternative if actual disk drives weren’t available. At 170 bytes per second, a 60 minute tape could provide ~250KB storage per side (and a tape cost ~$1), as compared to the early disks that stored only 160KB (and cost ~$5). But disk drives were improving and coming down in cost, as they were far more convenient by not having to be rewound.

Nearly every home/office personal computer since 1977 also included a cassette tape storage interface, so it was a familiar capability. The IBM PC had an architecture that was poised for the future, but its initial release retained many humble similarities to contemporary personal computers: 64KB RAM, monochrome display, ROM BASIC, and a tape storage device. But the system was modular and made of “off the shelf” components, and Microsoft DOS had done a good job of making the conventional memory seem like a contiguous block (by efficiently managing the up-to-10 segments of 16-bit addresses to appear as up to 640KB of RAM, while the upper six segments available were reserved for system or future uses).

In the normal IBM PC line, the IBM PC XT (5160) model dropped the cassette port in 1983 (although ROM BASIC was retained, since the BASICA.COM and related programs still at least partially referred to the ROM BASIC code). By then it was clear disk drives would indeed become affordable and higher capacity, and DOS was fully matured as a viable operating system (the D in DOS means Disk). Moreover physical mainboard space was needed to add room for expansion slots. All of this collectively rendered having an onboard cassette port obsolete (but cassette tapes did continue to be used for high capacity tape backup drives well into the late 1990s, using specialized controller hardware and tapes rather than typical audio cassettes).

The C64 (released in August 1982) and the Tandy Color Computer 2 (released in 1983) still included support for cassette tapes, and were sold up until the early 1990s as such. These systems were also connected to televisions, a cost savings approach allowing them to retail for around $200 versus the Apple and IBMs systems costing over $1000 for base models. IBM did continue inclusion of the cassette port in the IBM PCjr in 1984, but overall that system was a flop and short lived. The Tandy 1000 (released in late 1984) was deemed to be what the PCjr should have been, which that system didn’t include a cassette port.

Learning about tape cassette usage and operations helps reinforce the idea of data streams, such that “files on a disk” aren’t the only way for a program to be loaded or to receive data. But more fundamentally, the 5150 inclusion of the cassette port represents a “coming of age” sort of transition between the humble cost-cutting beginnings of the home/office personal computer between 1977-1981, and then becoming a more serious appliance that would “grow” with the family (through the modular design that allowed gradual upgrades at the owners pace).

History of IBM PC Cassette Software Support

For this article, we are not discussing about BASIC programs saved to cassette. That was a straightforward capability of Cassette BASIC (aka ROM BASIC), via its SAVE and LOAD commands. BASIC itself offered a certain set of capabilities (to prompt for input, store values, draw things on the screen). But BASIC also had the ability to POKE specific instructions into specific region of memory, sequences that could be a “pre-loader” to loading in even more code (without DOS). Used in this way, BASIC is a sort of built-in assembler.

The focus here is more along the lines of finding sequences of x86 instructions that exercise aspects of the system, without needing DOS. Software that either didn’t need an operating system (akin to the arcade machine games of the 1970s that could function with under 64KB RAM) or software that had its own operating system. Imagine a scenario of having no disks or no disk drives – treat the IBM PC like an embedded system. What could we still do with the system? Well, there is that Cassette Port…

Here is the extent of cassette tape usage on the IBM PC:

  • 1981 IBM Diagnostic
  • 1981 IBM Typing Tutor (allegedly a port from Apple II)
  • 1982 IBM Diagnostic Standard/Advanced 1.02
  • 1982 Avalon Hill’s Galaxy (port from 1981 CBM version, save/load game-state to cassette)
  • zzz… (ROM BASIC used to save and load BASIC programs, but essential no commercial software was delivered via cassette tape after 1982; the cassette port itself was removed from new IBM PC XT’s after March 1983)
  • 2018 retrohun BDASH/ARCHON Project (samples based on prior Galaxian COM1: work)
  • 2019 J. Bogin Reel to Reel 5150CAXX Project (read data streams from tape using BIOS calls, finally crossing the DOS|Tape divide!)
  • 2020 J. Bogin Vinyl DOS Boot Project (extreme custom BIOS)
  • 2021 MasonGulu Python ibm-xt-cassette-maker (WAV, works with BLOAD)
  • 2021 The .COM Specials 🙂 [see end of page]

I suspect many “boot-loader” games could have been made available on cassette. Also, a “pre-loader” could be written such that multiple segments could be initialized, so technically ROM-BASIC could be used to load programs larger than 64KB (after all, MS-DOS itself is a .COM program that ends up loading .EXE’s). But a single segment of 64KB across a tape is already 5-6 minutes of load time. So yes, we’re just entertaining some notional Steam Punk oriented parallel-universe where disk drives were never invented, so everyone takes tea breaks when loading a new program.

Even by the mid-1970s, paper tape was still being used to encode data and programs (such as the incident where Bill Gates’ original BASIC code was copied from a paper tape during a meeting). Punch card machines were still being used in banks, using equipment from the 1950s. Even if a certain technology was invented in a certain year, it could still take a decade for that technology to become affordable enough for main stream use (as production facilities took time to build up). While disk drives were available throughout the 1970s (for very expensive high end machines), audio tape were largely used between 1972 and 1986 for personal computers.


Introduction to the Cassette Port of the IBM PC 5150

Here is a comparison of the cassette on the back of the Tandy Color Computer (1980) and the IBM PC (1981). It is the same connector part. Since Microsoft had developed a ROM BASIC version for the Tandy systems, it was likely straightforward for Microsoft to adapt this code from the Z80 over to the x86 instruction set (at least in terms of the workflow and general timing).

For this reason, the same type of tape-drive connector cable used by the TRS-80 Color Computer series is identical to what the IBM PC 5150 uses. Instructions for how to construct this cable are available here. IBM was in quite a rush to design the 5150, and also had to keep the project fairly secret. Borrowing this existing cassette solution was likely very much appreciated by the team, to have a baseline save/load data capability checked off the ToDo list. [ strangely, for the later IBM PCjr, they used a different type of cassette cable – I don’t have much insight about that mystery; there was a newer Casssette ROM BASIC 1.20 for the PCjr, perhaps the cable change was an attempt at greater performance? ]

Below is the type of connector cable you are looking for (for the IBM PC 5150). This can be found using searches like “Cassette Interface Cable TRS-80 CoCo.” Then you need a cassette deck player. You can use the same cassette deck as the Tandy TRS-80 series, but should also be able to use essentially any other plain cassette deck player.

Note that software tools are also available to convert BASIC program and simple .COM programs into .WAV files, which can be loaded via playback on a smart phone. This means two things: (1) you can use your smartphone as the “PC” that plays WAV audio to be saved on to a physical tape, or (2) you can let the smartphone be the physical tape deck itself and just play the WAV directly into the 5150 (via the EAR plug on the cassette cable — which yes, might take a little trial and error, but there are only two possibilities).

One main advantage of using the TRS-80 series style tape deck is it has the 2.5mm REMote pin. Typical audio tape decks (nor smart phone) probably won’t have this. It’s not required, but it can be helpful if you aren’t familiar with the normal timing and workflow of working with tape.

This REMote pin gives the PC a little more control of when the tape rolls. So for instance, at the end of loading a data stream, it can stop the tape even if the PLAY button is still pressed down. Or conversely, you can press PLAY to get ready for a LOAD, but the tape won’t actually roll until the LOAD instruction is invoked from ROM BASIC (via instructions on this REMote cable). Without this REMote cable, you may have to manually anticipate when to start and stop certain parts of the play back (and do so before certain timeout conditions occur, which may be 5-10 seconds).


Below is how to connect the “standard” cassette cable to the TRS-80 tape deck. The model I have is a CCR-81. There is a smaller CCR-82 which I’ve read has some reliability problems (but not confirmed). The CCR-83 is newer (late 1980s) and was released along with the Color Computer 3, but I haven’t yet verified what is really different about it from the CCR-81. Again, other tape decks can be used (probably even Mini-Tapes), but they probably won’t have the REMote port. Just keep your MIC and EAR plugs plumbing the right way. If things don’t work, just try reverse them.

The counter is purely mechanical and has no digital “smarts” about where it actually is on the tape. You just rewind the tape to the beginning (press RWD or REWIND button), then when it stops press the RESET COUNT button so they are both aligned to 0 (sort of like pressing TARE on a weight scale).

If you don’t have an AC power adapter for your TRS-80 tape deck, you can typically find a 6V DC power adapter fairly easily. If that fails, the TRS-80 tape deck can also run on some “C” batteries at the back.

When I was using this, I kept the VOLUME just a hair below 10. I’m not sure if this is just playback volume or has any effect on recording/MIC volume. In any case, just make sure it is not set very low (not 1..4).

One more thing to be aware of about the IBM PC 5150: Per the IBM Technical Reference, there is a jumper on the motherboard regarding “MIC” (75mv) vs “AUX” (0.68v) output on the cassette table line. This may be difficult to get to (s this jumper is located very closer to where the disk drives are), but if you have the case open, it may be worth double checking which setting you are on. If it set on AUX and things aren’t working, try switching to the AUX port of your recorder device (if you have one), otherwise try switching this jumper to MIC.

How to Encode a .COM to Tape Using 5150CAXX.EXE

Here are some step-by-step instructions for using 5150CAXX from MS-DOS to encode a file/program to cassette tape… (photos afterwards of the main highlights)

  • 1) Be sure the Cassette Interface cable is connected. The MICrophone is the jack towards the front (of the tape deck). The REMote jack is just behind the MIC (this allows the PC to use a relay to control when the tape will actually move, it uses a smaller 2.5mm jack). The EARphone jack is furthest to the rear. Then the 5-pin DIN side is connected to the back of the PC case, next to the KEYBOARD port.
  • NOTE: Yes, it will also work to place the MIC jack into the AUX jack instead. I think the two ports exist so you can do real-time mixing – for example, have one room with a person speaking/singing, and a second (AUXiliary) room with “sound effects” or background music (for fancier studios where these might be two separate rooms). But quality-wise I don’t know if there is any difference (I just always used the MIC jack instead of AUX).
  • 2) Rewind the tape all the way to the beginning and press the small black RESET switch next to the numbers on the top left of the cassette tape. With the tape rewound to the beginning, the counter should be RESET to 000.
  • 3) Press FWD (Fast Forward) to move the tape ahead until the dial number indicates a number that is between 2 to 5. This ensures you’ve moved the tape off the “clear portion” at the very beginning, and marks the “starting offset” of your data/program. Remember or note this number down. Sometimes you can lightly press FWD to Fast Forward a little bit, otherwise be prepared to press STOP. If you over shoot, then press RWD (Rewind) to go back. It doesn’t need to be perfect, any counter value between 2 to 5 is sufficient (or even halfway between counts, like “2.5”).
  • NOTE: This example assumes use of a new/blank tape. If there is already content on the tape, you can write over it at any index. Or FFWD (Fast Forward) to a higher index (for a 90 minute tape, my index was up around 600-700 towards the end).
  • 4) Decide which program you want to store. Most suitable will be .COM programs (under 64KB) that have no File I/O (meaning no high score lists or save-game feature). In this example, 5150CAXX.EXE is in the SYSTEM PATH (in C:\UTILS). If you don’t have a PATH, you can specify the full path to 5150CAXX.EXE like so: C:\UTILS\5150CAXX.EXE (otherwise you may need to copy 5150CAXX.EXE into the same directory as the program you want to write). For this example, we save PCPOOL.EXE (which is 45056 bytes) to cassette.
  • NOTE: To get files onto your 5150, you can use a NIC and FTP. Otherwise you can create an image with WinImage or the HXC image tool (if using an HXC disk emulator). If using the XT-IDE with CF (CompactFlash) cards, you can use USB from your main modern PC and just copy the file to a folder on the CF card (remember to use “8.3” limited filenames – 8 character filename, 3 character extension — otherwise the file from DOS will have some “~1” or “~2” as part of the filename).
  • 5) Go to where the target program is stored (“CD” commands). Then type the command: 5150CAXX /A /WB PCPOOL.COM 45056 (/A forces a pause before beginning, so you can double check and get ready to press PLAY+RECORD before things actually start; /WB is a “write binary” mode {or “write with a BASIC pre-loader”} that will write the designated data/program but then prefix that code with a loader that is appropriate for the size specified; PCPOOL.COM is the name of the file to be written, followed by a number that is the number of bytes associated with this program {if unknown, try 65535 or 65000 to just do a “max-size”}).
  • 6) As instructed by the program, press both PLAY+RECORD buttons at the same time on the tape deck. This action will not begin until you press any key, but with the REMote plugged in, you press PLAY+RECORD first, then press any key on the keyboard.
  • 7) Be patient. With a data rate of ~160 bytes per second, it will take approximately 1 minute per 9KB to save your program. This example, PCPOOL.COM of 45K and will take ~5 minutes to write to the cassette tape.
  • 8) When the recording is done, 5150CAXX indicates “Success!”
  • 9) Note the number that the dial is at before you adjust the tape. This number marks the END of the recording. Write this information down before doing a REWIND or FWD (such as if preparing to save something else). Try to give at least 1 or 2 spins of the dial before writing something else (or I “round up” the dial to the next 10; like if stopped at 13, then I would Fast Forward to 20 before writing the next program – this creates an obvious stretch of “white space” between data streams on the cassette).
  • 10) Write down the program name, the dial offset numbers (START and STOP), and a reminder about the expected file size. In this case, the file size is not too important, but is just useful metric information to keep track of. You can write this down on the cassette label (which is typically included in the case that the cassette came in).

The photos below step through the process.

Below is a brief video of what to expect while the recording takes place. Note the RED indicator light is illuminated, indicating that recording is occurring (and audio traffic is being heard on the microphone). If you don’t see this RED light illuminate, either the LED is broken or something is not working properly (cables might be plugged into the wrong slot or the tape deck has a failure).

How to Load a .COM that was Saved Using 5150CAXX

Now that something has been saved to a tape, you want to load it back onto the 5150 using that tape. You can use 5150CAXX itself to do that, and reconstruct your program back onto the DOS file system. In this way, 5150CAXX can be used to transfer a program from a 5150 that has disks/files, over to a 5150 that doesn’t. But the focus here is using ROM BASIC (built into the 5150) to load the saved program.

As was described early, /WB writes the binary stream, but prefixes that stream with a brief “boot loader.” This loader initializes the stream into memory (of a particular segment) and then invokes a CALL to begin executing that stream (where .COM programs are, by standard convention of .COM files, expected to start at offset 256). So the following steps are sort of the “opposite” of that WRITE, this is the corresponding way to READ that content and have it executed as a program.

[ summary photos of highlights further below ]

  • 1) The first step is boot the IBM PC into ROM (Cassette) BASIC. The /WB option was used while booted into DOS. But for this step, you need to be in the ROM BASIC of the machine (meaning no DOS is loaded or involved). This is done by removing all the bootable disks. If you have an XT-IDE hard drive, it is also possible to just press F8 during startup, which invokes RomBoot (which will cause Cassette BASIC to boot; unless those ROMs have been replaced). Alternatively, remove the CF card from the XT-IDE. And/or just open the drive bay latches and remove any disks from those.
  • 2) Press REWIND on the cassette and adjust the dial counter to the beginning count of the desired program to load. Typically rewind to a little bit earlier, maybe by half a dial or so. Because of “slop” in the cassette, if you FWD and RWD many times in a session, the number on the dial my start to get inaccurate (kind of just depends on the age and condition of the tape deck being used). You can also rewind to the beginning and start from 0 (reset the counter to 000) and FWD again (which is tedious, but generally more reliable). This is why it is important to write down the program offset numbers (especially the start locations; for 5150caxx the end location and byte size isn’t really that important when re-loading from Cassette BASIC). If all else fails, you don’t have or don’t know the counter index of where the program is stored at — just start loading content from the beginning of the tape, you’ll get there eventually (just don’t RUN until you have the right content actually loaded).
  • 3) With Cassette ROM BASIC loaded (C1.0 or C1.10), type LOAD ” “. The extra space after LOAD is essential, and space between the quotes will indicate to load whatever title is encountered next on the tape. This is how you can just load from index 000 and observe what is on the tape, since the loader will show the saved name of the content.
  • NOTE: you can also type LOAD ” “,R to auto-run the loader when it is done loading from tape (R meaning RUN). I generally don’t do this just in case something unexpected goes wrong, but if you’re stepping away for a bit and just want the program to run when ready, and you’ve loaded the program before, this is a nice option.
  • 4) You will see something like “pcpool .B Found.” displayed. B for BASIC, and the name should be what you expected from when the data was saved earlier. If it says something else, maybe the content in this area of the tape was saved over some previous content. You can try loading again with the tape slightly more forward.
  • NOTE: The above step hasn’t loaded the program/game yet. What it has loaded is a “pre-loader” that is programmed to read the next portion of the data stream on the tape, and load it into a specific location into memory (relative to the current segment, or whatever segment the pre-loaded switches to). Standard .COM programs are compiled to run relative to offset 0x100 (aka &H100, $100) or offset 256 decimal. Other binaries might load straight from offset 0, it really depends on what compiler or assembler was used to produce the program, and what OS is used to launch it.
  • 5) Without the “,R” option when loading, you now have the option to LIST the loader program. In this first phase, the program (PCPOOL) has not exactly been loaded yet. You can use command LIST to examine the loader program, which is mostly auto-generated during the SAVE process. The program contains some DATA values that will represent x86 executed instructions, and the CALL command is used to essentially “hand over execution” to the specified offset.
  • 6) Enter the “RUN” command to proceed with the loader program, which will require more content to be loaded from the saved tape content. It is this “second stage” that is loading the actual binary program into memory and then executing it.

Borrowing from the IBM PC BASIC 1.10 manual (4-151) about “types of files” supported by the LOAD command:

The photos below step through the process.

NOTE: The “601” error below is because I have no disk drives connected, but I keep the motherboard set at 2 disk drives anyway (in case a a day comes whenever I do want to install the FDC back in).


Using Python to Make Tape Loadable Binaries

There are two Python scripts available here that can convert BASIC (ascii tax) into a WAV (ROM BASIC refers to these as “.B” streams), and also a binary stream into a WAV (ROM BASIC refers to these as “.M” streams).

To use these, you will need to install Python 3 (available here for Windows, Linux, and macOS).

EXAMPLE 1: Using ASCII (BASIC) [ asciiwrite.py ]

Place the asciiwrite.py and the desired BAS (BASIC) file into a folder (or asciiwrite.py can be in some folder that is on the PATH). As an example of how to use this Python from the command line (your folder name and BAS filename might be different):

F:                              go to the drive with your working files
CD \TO_TAPE\EXAMPLE_BAS         Change Directory to the working files
DIR                             list working files (verify in right place)
asciiwrite.py FORTUNE.BAS fortune

If working correctly, you should see the Python begin processing like this:

When the Python is complete, you can issue two command to verify the results:

dir *.wav               verify the WAV file was created
dir *.bas               the "bytes written" total should match size of BAS file
start .                 open Explorer window of current folder, play the WAV

Once the WAV has been created, you then need a way to get ROM-BASIC of the 5150 to “hear it.”

Saving WAV to Tape: Using TRS-80 Tape Deck (or similar)

This approach involves a modern PC that can play a WAV file in real-time, and that you also have a TRS-80 or equivalent tape deck recorder. But it is certainly possible to also use a smartphone for this (details highlighted below).

  • 1) Connect standard audio cable from HEADPHONE jack of modern PC, connect other end to MIC jack of the TRS-80 Tape Deck. [ can also use a smartphone if it has earphone/headphone output and has a means of playing the WAV file ]
  • 2) Rewind the tape, reset the index to 000, fast forward to an index number that is not already used on the current tape. At 160 bytes per second, that means 1 minute of tape saves approximately 9600 bytes of data. This process can only reliably initialize 1 segment (64KB), so the maximum per program/data stream is approximately 6 minutes.
  • 3) Press PLAY+RECORD on the tape deck. Since there is no REMote control engaged, the tape will begin to roll right away.
  • 4) As quickly as possible, play the WAV file on your PC or smartphone. The RED LED light on the tape deck should illuminate, indicating it is “hearing audio” and it is being recorded to the tape. You can scream and make outside noise, that won’t effect the tape recording. But on the computer (or smartphone) playing the WAV, avoid multi-tasking and doing something else that may cause a sound (like popup audio from Facebook, playing YouTube in the background, etc.). Any audio besides the WAV tape file will corrupt the recording and not load correctly.
  • 5) Monitor the WAV playback or look for the RED LED light to turn off. When that happens, press STOP on the tape deck since the recording is finished. Which, of course, this should happen when the WAV file has finished playing completely.

Here is what the “standard audio” cable looks like (stereo two-ring plugs, although a mono-cable is probably fine also). And here is how the audio cable is connected between the tape deck and the playback device.

NOTE: Again, instead of a full desktop PC, the source of the WAV can be from a smartphone instead (as those are essentially pocket sized PCs).

To LOAD this ASCII (BASIC) file into IBM PC 5150 ROM BASIC

Once the WAV audio recording has been recorded to a tape, now you need to use ROM-BASIC to actually load the content into the 5150 RAM.

  • Rewind the tape, reset index to 000.
  • Fast forward to the counter index where the BASIC data starts (rewind before this about half a dial; like if the data is at index 70, roll to about index 69 or 69.5).
  • Boot to ROM-BASIC as has been described earlier (if using XT-IDE, press F8 on startup; or removing all disk drives and the XT-IDE CF card).
  • Issue the ROM BASIC command LOAD ” ” (the space is important, it will load any .A or .B that it finds, while skipping .M).
  • Then just do “LIST” to LIST the BASIC program. The program may not run correctly if there are any OPEN commands that attempt to load a disk file. ROM BASIC was developed early for the 5150 and could not anticipate the final disk format that MS-DOS would use, and so the ROM BASIC has no provisions for read or writing data from/to disks.
  • Type RUN to run the program.

Example of some BASIC commands to issue after the BASIC program has been loaded:

LOAD " "
(wait for the .A or .B content to be found on the tape; .M's will be skipped)
LIST
LIST 1000-1180
CLS
RUN

EXAMPLE 2: Using binary [ binwrite.py ]

The binwrite.py Python will create a WAV that is intended to later be loaded via the more formal BLOAD command in ROM BASIC. This is similar to 5150caxx, but the startup sequence is a bit different.

Similar to the ASCII (BASIC) Python described above, you can place the binwrite.py and desired binary to write in the same folder. On a more modern machine with Python installed, an example set of commands to convert to the binary program into a WAV audio is as follows:

f:
cd \to_tape\example_bin
dir
binwrite.py ptrooper.com ptrooper 0 0

The two parameters “0 0” (ZERO ZERO) are important, but for this example we will leave them 0 0. It is more advanced to use non-zero values, and it depends on what binary you are loading or what instructions you want to give for loading. For example, for a .COM program they are expected to be at offset 256. You could specify this while saving (creating the WAV) or do so during the load. Also, I think using “0” for the segment will keep the corresponding load happening at whatever the DEF SEG (current segment) is specified in BASIC. For now, keeping things simple, stick with “0 0”.

As with the ASCII (BASIC) script, when the processing is finished you can type some commands to verify the results:

dir *.wav       verify the WAV file was created
dir *.com       the bytes written should match the size of the program
start .         open Explorer at current folder, play the WAV to verify

Saving this WAV to tape is exactly the same as described above, using either a physical TRS-80 (or equivalent) cassette player or a smart phone.

To BLOAD this binary data or program using 5150 ROM BASIC, the steps are a little different than 5150caxx. Refer to the earlier 5150caxx instructions for how to enter ROM BASIC. Once you are in ROM BASIC, the commands go like this:

DEF SEG=&H2000       ' pick a segment, I'd stick below A000 (&H means HEX addr)
                     ' you can try segment 0, but might conflict with BASIC
BLOAD " ",256        ' "binary" LOAD into offset 256
                     ' all .COM programs start execution at 0x100 or
                     ' 256 decimal. Some auto-booter programs start at 0.
(wait for ptrooper data to be found and loaded)
A=256                ' set some variable to the offset to be loaded
CALL A               ' transition BASIC to execute at this offset

Playing BDASH and ARCHON from WAV (using smartphone)

These WAVs have been prepared here. I had trouble recording these WAVs to a physical audio tape, which may be related to the bitrate they are prepared at. In any case, how these WAVs were prepared used a slightly different process (than 5150caxx). I will use this section to more fully describe how to load these using a smartphone.

You can use your smartphone as the tape recorder to play back the WAV file, but there are a couple little important differences. Two things to remember are:

(1) some program data streams are loaded in two stages – stage 1 is a “pre-loader” that is a short set of BASIC instructions that basically tells the system where the stage 2 data is to be loaded (what segment, what offset, how much). Stage 2 is then the intended data stream itself. If no pre-loader is present, then BLOAD is probably needed (and to know which specific offset the corresponding program starts at).

(2) with no REMote connector attached, the PC can’t control when the PLAY button actually rolls the tape. So this is what you have to manage yourself manually when using a smartphone.

Here are the general guidelines to playing these WAV files to have them loaded on the IBM PC 5150:

  • When you play a WAV file, your player should show a sort of “histogram” of the frequencies in that audio. From this, you can see the two stages of encoding: the brief pre-loader followed by a blank gap then the data stream itself.
  • These two WAV files have the pre-loader. So after you boot into ROM BASIC, issue the normal LOAD ” “ command (space after LOAD and space in between the double quotes), then quickly press PLAY on your smartphone (for the WAV file you want to load). If you are too slow, the ROM BASIC will give up and timeout (usually in about 10 seconds or so; don’t be discouraged, just rewind and try again).
  • You can listen for the relay click on the 5150 where it is trying to tell the cassette to stop, or visually look for the “<data>.B Found” followed by the “Ok” on the screen. This means the pre-loader has been found. At this point, PAUSE your smartphone playback of the WAV file. This pause should occur while within the blank/gap portion of the WAV.
  • NOTE: LOAD ” “,R might work also, there is no real reason to stop at the gap other than to just examine the pre-loader program and verify it is as-expected.
  • If you did use regular LOAD ” “, then on the 5150, type the command RUN to execute the pre-loader program. This will initiate a request to load more data from the tape, and load as a predetermined segment:offset. So, resume the WAV playback on your smartphone for the remainder of the WAV to get loaded.

BELOW: A smartphone can be used to “input” any WAV into the IBM PC 5150, but it may be picky about the quality of the WAV recording (so be careful about converting other recording formats into WAV, there may be a quality loss that corrupts the data interpretation). So LOAD content, use the EARphone plug. To SAVE content, use the MICrophone plug.

Here is a visual reference to the above steps:

  • Remember, after LOAD ” ” and the .B has been found – press PAUSE on the WAV recording. You can inspect the pre-loader (LIST), then type RUN to resume the loading (likewise un-PAUSE the WAV and resume that also).
  • NOTE: You can use LOAD ” “,R to just load and run in one step. This way you shouldn’t have to pause the WAV recording on the smartphone – this is reasonable to do after a first test to verify everything was recorded and loads just fine.

Successful .COM to Tape Conversions (The .COM Specials)

The following is a list of programs I’ve written to tape and successfully loaded back (from tape) and executed from ROM BASIC without any lock-up of the system (using 5150caxx).

NOTE: I believe these are all CGA titles (except ORBIS). Even the 1982 titles. None of them support MDA (although some of them, like PCPOOL, seem to write debug values to the MDA buffers). If you know of any MDA games from the early days (besides games like Zork or Adventure), let me know. BEAST does support MDA, but unfortunately has other issues that prevent it from running completely.

#PCTitleFileSize
(bytes)
YearDeveloper (Publisher)Notes
1ParatrooperPARTROOP.COM164001982Orion Software, Inc.
2*PC ManPCMAN1.COM164481982Orion Software, Inc.(same author as PARTROOP)
3CrossfireCROSSFIR.COM164161982Sierra On-Line, Inc.
4The ExterminatorEXTERM.COM470901983Windmill Software Inc.
5Attack on AltairALTAIR.COM463601983Windmill Software Inc.Slow to start
6FroggerFROGGER.COM532471983Konami (Sierra On-Line)
7Buck Rogers: Planet of ZoomZOOM.COM599041984SEGA Enterprises, Inc.
8*ORBISORBIS.COM4546??????Requires VGA
9*PC PoolPCPOOL.COM450561984Dale Jurich
10*StyxSTYX.COM614401984Sierra On-LineOne round only then seems to lockup.
11Montezuma’s RevengeMONTAZUM.COM327681984Parker Brothers
12GalaxianGALAXIAN.COM614401983Namco Limited (Atarisoft)
13RobotronROBOTRON.COM407041983Williams Electronics, Inc.  (Atarisoft)
14Dig DugDIGDUG.COM241921983Namco Limited (Atarisoft)
15JoustJOUST.COM614401983Williams Electronics, Inc.  (Atarisoft)
16DefenderDEFENDER.COM616961983Williams Electronics, Inc.  (Atarisoft)
17Ms. Pac-ManMSPACMAN.COM552961984General Computer Corporation, Midway Mfg. Co. (Atarisoft)
18Moon PatrolPATROL.COM583061984Williams (Atarisoft)
19*BEASTBEAST.COM192001984Dan BakerPartially works
20ARCHON1984Anne, Jon, Paul (Electronic Arts)Offset 0 instead of 256
21Boulder Dash1984Peter, Chris (First Star Software)Offset 0 instead of 256
* = IBM PC exclusive (i.e. not ported to other platforms)

Basically any program that avoids any DOS specific interrupts, and uses BIOS calls only, has a chance of working. .COM programs are, by standard convention ever since the CP/M days, are loaded at offset 0x100 (the earlier 256 bytes being reserved for command line parameters). Anything that stores high scores to a file probably won’t work, or any program that references any “external” file from the file system (since the file system is a construct of the operating system, not a BIOS standard). That said, a .COM could “invent” its own disk format (but it would require the disk to be formatted accordingly, and spend a lot of code space implementing that layout).

EXE programs (start with “MZ”) probably won’t work (they don’t start at 0x100 and the format is designed to load more “organically” depending on the state of the operating system). But maybe we’d be surprised and some of them can work, maybe with just really minor adjustment.

Here is a list of titles I tried to write to tape but would not play correctly when loaded…

  • Tetris (has a high score list on disk)
  • Roller Bro (too bad, it’s a fun game)
  • Apple Panic
  • Digger (DigDug works, this Digger is something different – unfortunate, as for me personally I remember Digger being my first IBM PC game I purchased from the store)
  • AstroDodge
  • Beast (does partially show a map; a few minor adjustments into NOOPs might get this thing going from tape)

Back to BASICs (with your Smartphone)

This article is mostly to describe how to store assembly/binary programs to cassette and load them back using ROM BASIC. For completeness, I also want to cover how to use ROM BASIC to store normal regular BASIC programs to tape, which is what ROM BASIC was primarily intended for.

So for this, just boot to ROM-BASIC like normal (remove CF card, no disks, or F8 with XT-IDE). At the ROM-BASIC prompt, suppose you key in a simple BASIC program, like one of the following:

Test My Segments

10 N = 0:REM START FIRST SEGMENT
20 DEF SEG = N
30 POKE 50,100:REM POKE A VALUE
40 A = PEEK(50):REM PEEK SHOULD RETURN SAME VALUE
50 IF A<>100 GOTO 90:REM IF NO, ASSUME NO MORE SEGMENTS
60 N = N+4096:REM INCREMENT TO NEXT SEGMENT
70 GOTO 20
80 PRINT (N/4096)*64;
90 PRINT "KB"

Count My RAM

10 N=0:S=0
20 DEF SEG=N
30 FOR I = 0 TO 63
40 POKE I*1024,100
50 A=PEEK(I*1024)
60 IF A<>100 GOTO 80
70 NEXT I
80 PRINT "SEG ";:PRINT N/4096;
90 PRINT "KB=";:PRINT I
100 IF S=15 GOTO 130
110 N=N+4096:S=S+1
120 GOTO 20
130 PRINT "DONE"

Guess My Number

10 N=INT(RND*100)+1:G=0
20 PRINT "GUESS MY NUMBER (1-100)";:INPUT A
30 G=G+1
40 IF A=N GOTO 100
50 IF A<N GOTO 70
60 IF A>N GOTO 80
70 PRINT "TOO LOW!":GOTO 20
80 PRINT "TOO HIGH!":GOTO 20
100 PRINT "CORRECT!"
110 PRINT "YOU TOOK ";:PRINT G;:PRINT " TRIES"

Then you type RUN to run the program. Now if you power off the system, you lose your program. Bummer. Instead, you can save your program to your Smartphone!

You still need the Cassette cable described earlier in this article. Then, do…

SAVE "program"

Set your Smartphone to record input into the microphone.

[TBD]

One thought on “5150: Setting up Tape Deck Connection (because the 5150 can)

  1. Hi,
    with 5150CAXX, you do not have to specify an explicit file size after a /W (or /WB) command, this is autodetected. The [bytes] argument for a record operation is provided if you only want to record a part of said file, e.g. first 8K or first 10 bytes, etc. Specifying the exact file size, as in the article, won’t hurt anything though.

    Regards

Leave a Reply

%d bloggers like this: