Tape recorder emulator for ZX-Spectrum

    Oddly enough, even now, after so many decades, there are many people who are interested in the ZX-Spectrum. And the matter is not limited to software emulators, no. These people have quite a real, “iron” Spectrum. The vast majority of these computers are equipped with drives, but there are instances only with a tape input. 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 the audio file, for example, if the game requires loading levels. And the audio files take up a decent place ... Of course, there are still different programs for smartphones that reproduce data file formats for the tap and tzx Spectrum. But it is possible for these same purposes to assemble a hardware tape recorder emulator described in this article.

    The described emulator is assembled 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 didn’t need this).


    The appearance of the emulator tape recorder in my performance.

    The emulator circuit is shown in the figure below. The circuit of the emulator tape recorder.




    The display uses a 1602 display, an atmega16 microcontroller, and MB81C4256 dynamic RAM. Why do I need RAM in such an emulator, because you can sequentially read two blocks (one is read, the other is output) from the memory card? Yes you can. But the use of large RAM simplifies the program - all the output data is entirely in RAM, and it is quite simple to read and output them sequentially. In addition, the presence of RAM allows you to overclock the signal output speed to almost the maximum for the ZX-Spectrum. This, however, will require a substantial modification of the boot program in the Spectrum ROM. In this emulator, the maximum data output speed is four times greater than the standard Spectrum download speed. That is, a modified ROM is required. The firmware of such a modified ROM is presented in the archive.

    The format of the tap file is very simple: 2 bytes is the block size, followed by the block data. And so on until all the blocks are exhausted.

    The ZX-Spectrum tape signal is a frequency-modulated signal, with the highest frequency being encoded to zero and the clock signal (the frequency of the clock signal is slightly higher than that of zero). A frequency 2 times lower than the frequency of zero is encoded unit. A frequency of 2.5 times lower than the frequency of zero encoded pilot tone (sounds pi-and-and-and-and at the beginning of the download). The figure shows the signal format in clock cycles of the Z80 processor (frequency in the ZX-Spectrum is 3.5 MHz, if anyone forgot). At first there is a long (several seconds) pilot tone, then a clock signal follows, and after it data is already being output.


    ZX-Spectrum tape format.

    Actually, there’s nothing complicated at all. If such a signal is issued from the microcontroller, then its spectrum will be happy to receive and load. To generate a signal in the program, a regular timer is used that switches the output of the tape recorder at predetermined intervals.

    Here is a video of the tape recorder emulator:



    And here is work at 4x speed:



    The archive contains firmware, firmware sources, a printed circuit board, a circuit, ZX-Spectrum ROM firmware for speeds 4x and 2x, a TAP to WAV conversion program, and a reverse conversion program from WAV to TAP.

    Update:
    Program and circuit board on github.

    Also popular now: