shaymanjohn / speccyMac

ZX Spectrum emulator for OSX, written in Swift
GNU General Public License v3.0
15 stars 3 forks source link

Add support for .tap tape image files #27

Open hippietrail opened 2 years ago

hippietrail commented 2 years ago

I think .tap is the next file format that is both common and easy to implement since it's not an audio format and doesn't handle fastloaders.

I intend to work on it so you can assign it to me if you wish.

hippietrail commented 2 years ago

I spent some time deconstructing some TAP files and this won't be as straightforward as I had anticipated due to copy protection.

The TAP format is a just a byte-for-byte representation of the standard Speccy tape format. It can't represent turboloaders etc. but it can represent anything the ROM tape routines can use, which still allows for quite a bit of trickery.

Each block on the tape does indicate a starting address in memory, but often the BASIC loader loads the blocks into different addresses. This requires analysing the BASIC program.

Of the other Speccy emulators that work with TAP files, some turn the TAP file back into an audio stream and you use the emulator's cassette interface to load them, just as if they were WAV files. But some do manage to instantly load the games. I have to assume they're parsing the BASIC since there's probably a whole range of tricks that were used in those loader programs.

I haven't looked into TZX files yet but I'm expecting the same.

hippietrail commented 2 years ago

After thinking about it I don't think other emulators try to interpret the BASIC, they just run it and actually load the audio they generate from TAP and TZX files. And the ones that seem to load them instantly would intercept the ROM routines.

I'm not too familiar with the rest of the emulator but I'm assuming this would be quite a bit of work to support. Definitely beyond me at this stage unfortunately.