Welcome, Guest. Please login or register.


Author Topic: TAP file structure (Read 2831 times)

Offline tdididit

  • Newbie
  • Posts: 6
  • Country: pl
    • tdididit.com
TAP file structure
« on: 2016.August.04. 18:56:19 »
Where i can find some informations about TAP file structure ?

Thanks for any info :)
Takich dwóch jak nas trzech to nie ma ani jednego...

Offline geco

  • EP addict
  • *
  • Posts: 7082
  • Country: hu
    • Támogató Támogató
Re: TAP file structure
« Reply #1 on: 2016.August.04. 20:17:17 »
Where i can find some informations about TAP file structure ?

Thanks for any info :)
Unfortunately I do not know either, but it should similar to the speccy TAP I think
http://www.worldofspectrum.org/faq/reference/formats.htm#Tape
http://www.worldofspectrum.org/TZXformat.html#STDSPEED

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: TAP file structure
« Reply #2 on: 2016.August.04. 20:26:32 »

Offline tdididit

  • Newbie
  • Posts: 6
  • Country: pl
    • tdididit.com
Re: TAP file structure
« Reply #3 on: 2016.August.04. 20:40:48 »
Cassette Driver specification will help me a bit later :)
I want to build stand alone TAP SD Player with CTRL signals support.

Question is what is in first 512 bytes of every TAP file, it not looks like TZX or C64 TAP-file chunks
Takich dwóch jak nas trzech to nie ma ani jednego...

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14723
  • Country: hu
    • http://enterprise.iko.hu/
Re: TAP file structure
« Reply #4 on: 2016.August.04. 20:49:13 »
The question: which TAP file? As I know least 3 different version exist (EPTE, TAPir, ep128emu) :oops:

Anyway the TAP files not too commonly used. The pure data files used, because the EXDOS and PC use same FAT filesystem.

My suggestion for this project: store the files in subdirectory, and add FILELIST.TXT which define the playing order.
This list can be created manually, but possible to do with ep128emu LUA script, which is save the filenames during the program loading.

Offline tdididit

  • Newbie
  • Posts: 6
  • Country: pl
    • tdididit.com
Re: TAP file structure
« Reply #5 on: 2016.August.04. 21:10:06 »
The question: which TAP file? As I know least 3 different version exist (EPTE, TAPir, ep128emu) :oops:

Anyway the TAP files not too commonly used. The pure data files used, because the EXDOS and PC use same FAT filesystem.

My suggestion for this project: store the files in subdirectory, and add FILELIST.TXT which define the playing order.
This list can be created manually, but possible to do with ep128emu LUA script, which is save the filenames during the program loading.

Yes, I was thinking about it too, but would be nice to support EPTE/TAPIR file format too
Takich dwóch jak nas trzech to nie ma ani jednego...

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14723
  • Country: hu
    • http://enterprise.iko.hu/
Re: TAP file structure
« Reply #6 on: 2016.August.04. 22:04:23 »
About the TAPir ask MrPrise, he wrote it.

Offline IstvanV

  • EP addict
  • *
  • Posts: 4822
Re: TAP file structure
« Reply #7 on: 2016.August.05. 19:37:30 »
The ep128emu format TAP files are basically 1-bit audio files.

There are two versions of the format: the older and simpler version has no header and uses a fixed sample rate of 24000 Hz (one cycle of the leader tone, sync bit, 0 bit, and 1 bit is 10, 16, 12, and 8 samples, respectively). The samples are encoded in most significant bit first order. The EXOS cassette data format is documented in the technical information at page 83 of the PDF file.

The more advanced ep128emu TAP format begins with a 4096 bytes header, which contains 1024 32-bit integers in MSB first format. The first 4 of these are: 0x0275CD72, 0x1C445126, bits per sample (must be 1, 2, 4, or 8, but only 1 is useful in practice), and the sample rate in Hz. The remaining 1020 values are markers, a table of positions on the tape in samples (not bytes), unused entries are set to 0xFFFFFFFF. The markers usually indicate the starting positions of the files on the tape, so that it is possible to easily find them in the emulator (Alt+, and Alt+.).

The EPTE tape format consists of a 512 bytes long header, and then all the EXOS format cassette data as raw bytes (not audio), except the leader tones and sync bits are not included. So, the emulator needs to synthesize the audio from this data. In the header, at an offset of 128 bytes, there is always the 32 bytes long string "ENTERPRISE 128K TAPE FILE       ". The rest of the header contains the starting position (in bytes, relative to the beginning of the cassette data) of each chunk as 32-bit LSB first integers. Thus, the first 128 bytes of the header is a table of 32 chunk positions. However, this is followed by the "ENTERPRISE 128K TAPE FILE       " string, so it is not clear if more than 32 chunks are possible by continuing the table after skipping these 32 bytes. Fortunately, most programs (except some large ones usually loaded from disk) do not need more than 32 chunks. To play one chunk as audio, the emulator generates the leader tone and the sync bit, and then the raw data bytes, which are encoded in least significant bit first order.