alvieboy / ZXInterfaceZ

ZX Spectrum InterfaceZ
32 stars 4 forks source link

TAP: Allow recording from TAP/TZX files into physical tapes #84

Open alvieboy opened 3 years ago

alvieboy commented 3 years ago

Allow recording from TAP/TZX files into physical tapes. This should have a dedicated menu entry.

The internal TAP/TZX player shall be used for this purpose, and should be compatible with all models. On the ZX Spectrum side, we should read from an FPGA port the value to be written to ULA port 0xFE, so that we do not need to compute anything on the Spectrum. Duplication should then enter the below loop (with interrupts disabled) to propagate the audio.

        LD  C, PORT_VIRTUALAUDIO
_loop:
    IN  A, (C)  ; Flags updated accordingly
        OUT ($FE), A
    JR  NZ, _loop

The PORT_VIRTUALAUDIO port should return 0x00 when the tape player is not running, so we can exit the loop. When the tape player is running, the values should be "00001011" or "00000100" depending if the audio bit is '1' or '0'. This allows the value read to be output directly to the ULA, and includes a specific border for progress monitoring.