Oddly enough, even now, after so many decades, there are many people who are interested in the ZX-Spectrum. And business is not limited to software emulators, no. These people have quite a real, "iron" Spectrum. The overwhelming majority of these computers are equipped with disk drives, but there are also specimens with tape-recorder input only. Such a computer can be downloaded, for example, from an audio player. But with this method of loading, it is inconvenient to switch between data blocks inside an audio file, for example, if a game requires loading levels. Yes, and audio files occupy a decent place ... There are, of course, still different programs for smartphones, reproducing data file formats for Spectrum tap and tzx. But it is possible for the same purposes to assemble a hardware tape recorder emulator described in this article. The emulator described is built on the basis of the atmega16 microcontroller and is able to play tap-files lying on the SD-card. He does not know how to write files to the SD card (yes, I did not need this).
The appearance of the emulator tape in my performance.
The emulator circuit is shown in the figure below. ')
The scheme of the emulator tape.
The display uses 1602, atmega16 microcontroller and MB81C4256 dynamic RAM. Why do you need RAM in this emulator, because you can sequentially read two blocks (one read, the other output) from the memory card? Yes you can. But the use of a large RAM simplifies the program - all output data is entirely in RAM, and it is sufficient to read and output them sequentially. In addition, the presence of RAM allows you to overclock the speed of the output signal to almost the maximum for the ZX-Spectrum. This, however, will require a significant modification of the boot program in the Spectrum ROM. In this emulator, the maximum output speed is four times faster than the standard Spectrum download speed. That is, a modified ROM is required. Firmware such a modified ROM is presented in the archive.
The tap-file format is very simple: 2 bytes is the block size followed by the block data. And so on until all the blocks are exhausted.
The tape signal from the ZX-Spectrum is a frequency-modulated signal, with zero and sync signals being encoded at the highest frequency (the frequency of the sync signal is slightly higher than that of zero). Frequency is 2 times lower than the frequency of the zero coded unit. A frequency 2.5 times lower than the frequency of a zero is coded pilot-tone (sounds of pi-and-and-and-and at the beginning of the download). The figure shows the signal format in cycles of the Z80 processor (frequency in the ZX-Spectrum 3.5 MHz, if anyone forgot). First, there is a long (a few seconds) pilot tone, then a clock signal follows, and after it the data is already output.
The format of the tape signal ZX-Spectrum.
Actually, there is nothing complicated at all. If such a signal is issued from a microcontroller, then the Spectrum will gladly accept and load it. To generate a signal in the program, a regular timer is used, which switches the output of the tape recorder at specified intervals.
Here is the video of the tape recorder emulator:
But work at a speed of 4x:
The archive firmware, firmware sources, circuit board, circuit, firmware ROM ZX-Spectrum for speeds 4x and 2x, the program converts TAP to WAV and the program back to convert from WAV to TAP.