A library of tap2sna.py recipes

The place for codemasters or beginners to talk about programming any language for the Spectrum.
User avatar
SkoolKid
Manic Miner
Posts: 414
Joined: Wed Nov 15, 2017 3:07 pm

A library of tap2sna.py recipes

Post by SkoolKid »

In July of 2020 I said that in an ideal world where I had the time, I'd build a large library of tap2sna.py recipes (for producing pristine snapshots of ZX Spectrum games) for any and all to use as they see fit. Back then, given the crap quality of tap2sna.py, that would have been a monumentally difficult and hair-pullingly frustrating task.

Nowadays, though, tap2sna.py is less crap than it was (thanks to --sim-load), so I'm giving the idea a go.

t2sfiles

This library isn't large (yet), but it's a start. I'll add new recipes to it as time allows, and will happily accept contributions as well. If you're on GitHub already you could create a pull request, or submit your recipe in an issue. Or you could just post it here in this thread. Whatever's easiest.
SkoolKit - disassemble a game today
Pyskool - a remake of Skool Daze and Back to Skool
User avatar
SkoolKid
Manic Miner
Posts: 414
Joined: Wed Nov 15, 2017 3:07 pm

Re: A library of tap2sna.py recipes

Post by SkoolKid »

@Bedazzle is the winner of the First Contributor award:

https://github.com/skoolkid/t2sfiles/co ... 7e33240e67

Who will win the Second Contributor award? The race is on!
SkoolKit - disassemble a game today
Pyskool - a remake of Skool Daze and Back to Skool
User avatar
SkoolKid
Manic Miner
Posts: 414
Joined: Wed Nov 15, 2017 3:07 pm

Re: A library of tap2sna.py recipes

Post by SkoolKid »

Library update: There are now over 1200 recipes in the t2sfiles repository.

So far I've been picking the low-hanging fruit as far as recipe-generation goes - meaning games whose start address tap2sna.py can automatically determine. That will continue for a bit, and then I'll have to tackle some of the higher-up fruit. Speedlock-protected games perhaps - since they all LOAD in much the same way, I might be able to automate the process to some extent (assuming I can identify all the Speedlock TZX files in my collection).

Some things I've noticed/learned in this process:
  • Many adventure games have the same start address (a Quill thing, perhaps).
  • tzxvault.org is a bit weak when it comes to Spanish games.
  • My collection of TZX files (originally pulled from Martijn's WoS) is old.
The main evidence for the last one is that I have a bunch of Odin and Activision and Electric Dreams titles that are sadly denienced these days. No Ultimate titles, though, so there's that.
SkoolKit - disassemble a game today
Pyskool - a remake of Skool Daze and Back to Skool
User avatar
SkoolKid
Manic Miner
Posts: 414
Joined: Wed Nov 15, 2017 3:07 pm

Re: A library of tap2sna.py recipes

Post by SkoolKid »

Library update #2: There are now exactly 3861 recipes in the t2sfiles repository.

All the low-hanging fruit (i.e. games for which tap2sna.py correctly determines the start address automatically) have been picked as far as I can tell, so there will probably be a bit of a pause in new uploads until I decide what types of games to tackle next.
SkoolKit - disassemble a game today
Pyskool - a remake of Skool Daze and Back to Skool
User avatar
SkoolKid
Manic Miner
Posts: 414
Joined: Wed Nov 15, 2017 3:07 pm

Re: A library of tap2sna.py recipes

Post by SkoolKid »

Library update #3: There are now exactly 5229 recipes in the t2sfiles repository.

If there's no recipe for a particular game in the repository at the moment, it's probably for one of the following reasons:
  • The game executes some BASIC before doing a 'USR nnnnn', or is entirely written in BASIC, which makes specifying a "start address" that actually works somewhat tricky. (I'll probably add support for specifying a start address for such games in the next version of SkoolKit.)
  • The game requires issue 2 keyboard emulation. (I'll probably add support for such games - e.g. Madhatter, Spinads, Rasputin - in the next version of SkoolKit.)
  • The game doesn't run on a 48K Spectrum. (I might add support for 128K games later.)
  • The game requires user input during the LOAD process, e.g. Stop the tape / Keyboard or Joystick? / Start the tape. (I have no plans to add support for these annoying games.)
  • --sim-load fails to produce a working snapshot, and Fuse fails to load the game too. (If Fuse can't load the game - even with all tape acceleration disabled - I'm inclined to conclude that the tape is just broken.)
  • --sim-load fails to produce a working snapshot, but Fuse does load the game successfully. (So far I've found six tapes for which this is the case. I'll probably investigate these further at some point.)
SkoolKit - disassemble a game today
Pyskool - a remake of Skool Daze and Back to Skool
User avatar
Bedazzle
Manic Miner
Posts: 309
Joined: Sun Mar 24, 2019 9:03 am

Re: A library of tap2sna.py recipes

Post by Bedazzle »

SkoolKid wrote: Wed Apr 05, 2023 9:39 pm Library update #3: There are now exactly 5229 recipes in the t2sfiles repository.
Is somewhere a list that is not done yet?
User avatar
SkoolKid
Manic Miner
Posts: 414
Joined: Wed Nov 15, 2017 3:07 pm

Re: A library of tap2sna.py recipes

Post by SkoolKid »

Bedazzle wrote: Thu Apr 06, 2023 1:47 pm Is somewhere a list that is not done yet?
No, but I'll see if I can generate one.
SkoolKit - disassemble a game today
Pyskool - a remake of Skool Daze and Back to Skool
User avatar
SkoolKid
Manic Miner
Posts: 414
Joined: Wed Nov 15, 2017 3:07 pm

Re: A library of tap2sna.py recipes

Post by SkoolKid »

Here it is:

https://skoolkit.ca/tapes/games-not-done.zip

It's a JSON file of all the games I'm aware of for which no t2s file exists in the repository.
SkoolKit - disassemble a game today
Pyskool - a remake of Skool Daze and Back to Skool
Stu
Manic Miner
Posts: 246
Joined: Wed May 20, 2020 2:59 pm

Re: A library of tap2sna.py recipes

Post by Stu »

A quick contribution from me, the existing t2s file for Elite only covers one side of the tape, these create snapshots of both sides (which differ in the lineup of ships):

Code: Select all

http://www.tzxvault.org/Spectrum/TZX/Elite-48k.zip
elite-48k-side-a.z80
--sim-load
--tape-name "Elite - 48k - Side A.tzx"
--tape-sum 6b0ee146cf206d997c901c0e67460c82
--start 53369

Code: Select all

http://www.tzxvault.org/Spectrum/TZX/Elite-48k.zip
elite-48k-side-b.z80
--sim-load
--tape-name "Elite - 48k - Side B.tzx"
--tape-sum 9dd57ef1bb0c42315951208593719960
--start 53369
The file https://spectrumcomputing.co.uk/pub/sin ... te.tzx.zip is the same as the TZX Vault one if SC links are preferred.
User avatar
SkoolKid
Manic Miner
Posts: 414
Joined: Wed Nov 15, 2017 3:07 pm

Re: A library of tap2sna.py recipes

Post by SkoolKid »

Stu wrote: Thu Apr 06, 2023 8:38 pm A quick contribution from me, the existing t2s file for Elite only covers one side of the tape, these create snapshots of both sides (which differ in the lineup of ships):
Thanks! I'll add this to the repository today.

(One of the most annoying things about making t2s files - so far - is finding multi-sided tapes where it's not obvious whether the sides are actually different.)
SkoolKit - disassemble a game today
Pyskool - a remake of Skool Daze and Back to Skool
User avatar
Bedazzle
Manic Miner
Posts: 309
Joined: Sun Mar 24, 2019 9:03 am

Re: A library of tap2sna.py recipes

Post by Bedazzle »

SkoolKid wrote: Fri Apr 07, 2023 12:11 pm (One of the most annoying things about making t2s files - so far - is finding multi-sided tapes where it's not obvious whether the sides are actually different.)
Load / Save two snaps / Compare?
User avatar
SkoolKid
Manic Miner
Posts: 414
Joined: Wed Nov 15, 2017 3:07 pm

Re: A library of tap2sna.py recipes

Post by SkoolKid »

Bedazzle wrote: Sat Apr 08, 2023 5:25 am Load / Save two snaps / Compare?
Yep - that's exactly why they're so annoying. This takes time, and life is short. :D
SkoolKit - disassemble a game today
Pyskool - a remake of Skool Daze and Back to Skool
User avatar
cmal
Manic Miner
Posts: 633
Joined: Fri Jun 05, 2020 1:05 am
Location: California

Re: A library of tap2sna.py recipes

Post by cmal »

Great project that you've taken on, @SkoolKid . How does one tell which is a better and "more accurate" tzx or tap file? For example if the tzx exists but it's a hacked version, or if 3 tzx files exist and they all have different MDA checksums?
User avatar
SkoolKid
Manic Miner
Posts: 414
Joined: Wed Nov 15, 2017 3:07 pm

Re: A library of tap2sna.py recipes

Post by SkoolKid »

cmal wrote: Sun Apr 09, 2023 6:47 pm Great project that you've taken on, @SkoolKid . How does one tell which is a better and "more accurate" tzx or tap file? For example if the tzx exists but it's a hacked version, or if 3 tzx files exist and they all have different MDA checksums?
Good question, and I don't have a good answer. So far I've assumed, for each game I've looked at, that the TZX file (if it exists) of the original release is the best one to use. (And if there's more than one of those, I go with the first one listed on the game's page on worldofspectrum.net.) If I knew that it was a hacked version, though, I would look for an alternative.

By the way, if anyone does spot a hacked tape being used somewhere in the repository, please report it as a bug.
SkoolKit - disassemble a game today
Pyskool - a remake of Skool Daze and Back to Skool
User avatar
cmal
Manic Miner
Posts: 633
Joined: Fri Jun 05, 2020 1:05 am
Location: California

Re: A library of tap2sna.py recipes

Post by cmal »

SkoolKid wrote: Sun Apr 09, 2023 8:02 pm Good question, and I don't have a good answer. So far I've assumed, for each game I've looked at, that the TZX file (if it exists) of the original release is the best one to use. (And if there's more than one of those, I go with the first one listed on the game's page on worldofspectrum.net.) If I knew that it was a hacked version, though, I would look for an alternative.
Seems like a good enough answer to me. I think that's what I would do as well.
I have some old TZX files which are type-ins which I entered BITD. I tried tap2sna converting Spraymania.tzx (type-in from Your Computer) from a TZX to a Z80 and that worked well. Then I tried Cheekah's Exploits and that did not work at all. After some debugging it turns out the BASIC loader loads some code which draws a loading screen and loads the final block of code using the standard ROM loader, then runs the game code.
What's the best way to handle this scenario with tap2sna? I was able to manually create a sort-of-perfect .Z80 snapshot using SpecEmu's debugger and saving a snapshot right after the loading was complete ( I saved the snapshot while still in debug mode so that the game code didn't resume executing).

Here's the t2s I used:

Code: Select all

"file:///C:/Files/ZX%20Spectrum/tap2sna%20Recipes/t2sfiles-master/Magazine%20Games/Cheekah's Exploits.tzx"
cheekahs-exploits.z80
--sim-load
--tape-name "Cheekah's Exploits.tzx"
--tape-sum 7cdeea4e23fce8b5753c1735f2a9b0aa
--start 32614
User avatar
SkoolKid
Manic Miner
Posts: 414
Joined: Wed Nov 15, 2017 3:07 pm

Re: A library of tap2sna.py recipes

Post by SkoolKid »

cmal wrote: Mon Apr 10, 2023 1:24 am I have some old TZX files which are type-ins which I entered BITD. I tried tap2sna converting Spraymania.tzx (type-in from Your Computer) from a TZX to a Z80 and that worked well. Then I tried Cheekah's Exploits and that did not work at all. After some debugging it turns out the BASIC loader loads some code which draws a loading screen and loads the final block of code using the standard ROM loader, then runs the game code.
What's the best way to handle this scenario with tap2sna?
It's hard to tell without seeing exactly what the loader does. At the moment, there is no way to tell tap2sna.py to "stop the simulation at address X, but only after the tape has finished", which sounds like what you may need (and which many BASIC-heavy games need). That's a feature I'm planning to add in the next version of SkoolKit.

What's the significance of the 32614 start address, though?

(Also, by the way, if your recipe points to a local TZX/TAP file, the --tape-name and --tape-sum arguments are redundant. Those arguments are useful only for verifying the contents of a remote zip archive.)
SkoolKit - disassemble a game today
Pyskool - a remake of Skool Daze and Back to Skool
User avatar
cmal
Manic Miner
Posts: 633
Joined: Fri Jun 05, 2020 1:05 am
Location: California

Re: A library of tap2sna.py recipes

Post by cmal »

SkoolKid wrote: Mon Apr 10, 2023 2:59 pm It's hard to tell without seeing exactly what the loader does. At the moment, there is no way to tell tap2sna.py to "stop the simulation at address X, but only after the tape has finished", which sounds like what you may need (and which many BASIC-heavy games need). That's a feature I'm planning to add in the next version of SkoolKit.
Makes sense what you say. In my example, which I didn't explain very well, the BASIC loader is simple, but it has a machine code loader as well.
The BASIC loader looks like this:
10 CLEAR 32299: LOAD "" CODE: CLS : PRINT USR 32614
SkoolKid wrote: Mon Apr 10, 2023 2:59 pm What's the significance of the 32614 start address, though?
32614 is the start address of the machine code, according to the loader above. I realized after the fact that it's the wrong address to use for tap2sna.py because it loads another block of code by calling ROM address 1378. Only after that's done, the game starts.
SkoolKid wrote: Mon Apr 10, 2023 2:59 pm (Also, by the way, if your recipe points to a local TZX/TAP file, the --tape-name and --tape-sum arguments are redundant. Those arguments are useful only for verifying the contents of a remote zip archive.)
Great, that's nice to know. Thanks!
User avatar
SkoolKid
Manic Miner
Posts: 414
Joined: Wed Nov 15, 2017 3:07 pm

Re: A library of tap2sna.py recipes

Post by SkoolKid »

@cmal, I've just added support for stopping a simulated LOAD at the given --start address only after the tape has finished. If you want to test this new feature, grab a copy of the current development version of SkoolKit from GitHub and try this t2s file:

Code: Select all

"file:///C:/Files/ZX%20Spectrum/tap2sna%20Recipes/t2sfiles-master/Magazine%20Games/Cheekah's Exploits.tzx"
cheekahs-exploits.z80
--sim-load
--start 0x053f
-c finish-tape=1
(0x053f is the address of the SA/LD-RET subroutine in the ROM.)
SkoolKit - disassemble a game today
Pyskool - a remake of Skool Daze and Back to Skool
User avatar
cmal
Manic Miner
Posts: 633
Joined: Fri Jun 05, 2020 1:05 am
Location: California

Re: A library of tap2sna.py recipes

Post by cmal »

Hi @SkoolKid, Thanks for the change you made. I gave that a try but the Python script kept running without stopping. I stopped it with ctrl+C and then it produced a non-pristine z80 which worked but the PC was at some place well into the game code.
I adjusted the t2s file to read like this, which produces a pristine z80 file:

Code: Select all

"file:///C:/Files/ZX%20Spectrum/tap2sna%20Recipes/t2sfiles-master/Magazine%20Games/Cheekah's Exploits.tzx"
cheekahs-exploits.z80
--sim-load
--start 0x7FC8
Here's the mc loader code. You can see where 0x7FC8 is the EI instruction that runs right after loading the main code block.
Image

If you want to try it on your side, the TZX I used is on SC at Cheekah's Exploits

One method I find useful if the game uses a Basic loader which is difficult to get to or view is to place a breakpoint at address #34B6. That's the USR function in ROM and BC will contain the address of the USR address.
User avatar
SkoolKid
Manic Miner
Posts: 414
Joined: Wed Nov 15, 2017 3:07 pm

Re: A library of tap2sna.py recipes

Post by SkoolKid »

cmal wrote: Sat Apr 15, 2023 9:01 pm If you want to try it on your side, the TZX I used is on SC at Cheekah's Exploits
I could have sworn I looked for a TZX of the game right there a few days ago, but I must have missed it somehow. :?

Anyway, now that I can see the loading routine - and how it bypasses SA/LD-RET - I think 0x7FC8 is a good candidate for the start address. Another good one is 0x71AF (which is where the RET C returns to).
SkoolKit - disassemble a game today
Pyskool - a remake of Skool Daze and Back to Skool
User avatar
cmal
Manic Miner
Posts: 633
Joined: Fri Jun 05, 2020 1:05 am
Location: California

Re: A library of tap2sna.py recipes

Post by cmal »

SkoolKid wrote: Sat Apr 15, 2023 10:57 pm I could have sworn I looked for a TZX of the game right there a few days ago, but I must have missed it somehow. :?
You didn't miss it. It wasn't there a few days ago. I uploaded a bunch of TZXs a few days ago.

Then there was a database update on Apr 11. Only after that they would have been available.
User avatar
SkoolKid
Manic Miner
Posts: 414
Joined: Wed Nov 15, 2017 3:07 pm

Re: A library of tap2sna.py recipes

Post by SkoolKid »

Library update #4: There are now exactly 6579 recipes in the t2sfiles repository.

If there's no recipe for a particular game in the repository at this point, it's probably for one of the following reasons:
  • The game doesn't run on a 48K Spectrum. (I might add support for 128K games later.)
  • The game requires user input during the LOAD process, e.g. Stop the tape / Want instructions? / Start the tape. (I have no plans to add support for these annoying games.)
  • --sim-load fails to produce a working snapshot, and Fuse fails to load the game too. (If Fuse can't load the game - even with all tape acceleration disabled - I'm inclined to conclude that the tape is just broken.)
  • --sim-load fails to produce a working snapshot, but Fuse does load the game successfully. (So far I've found eight tapes for which this is the case. I'll probably investigate these further at some point.)
  • The game isn't in my collection of TZXs downloaded from worldofspectrum.net.
If you think a game is missing that really should (and could) be there, I'm happy to take requests and contributions.
SkoolKit - disassemble a game today
Pyskool - a remake of Skool Daze and Back to Skool
User avatar
SkoolKid
Manic Miner
Posts: 414
Joined: Wed Nov 15, 2017 3:07 pm

Re: A library of tap2sna.py recipes

Post by SkoolKid »

Library update #5: There are now exactly 8267 recipes in the t2sfiles repository.

I did another sweep of the worldofspectrum.net archive and found some tapes that had been hiding under the sofa cushions, so to speak.

At this point I'm fairly confident that I've t2s-ified 99%+ of the games on worldofspectrum.net that actually can be t2s-ified.
SkoolKit - disassemble a game today
Pyskool - a remake of Skool Daze and Back to Skool
Stu
Manic Miner
Posts: 246
Joined: Wed May 20, 2020 2:59 pm

Re: A library of tap2sna.py recipes

Post by Stu »

Ahh I started looking at some of the missing files but never got round to raising a PR :roll: Looks like you've got all the ones I did anyway, although I used the TZX of Total Eclipse: The Sphinx Jinx instead of the TAP so I don't know if it's still useful?

Code: Select all

https://worldofspectrum.net/pub/sinclair/compilations/t/TotalEclipse+TheSphinxJinx.tzx.zip
total-eclipse-2-the-sphinx-jinx.z80
--sim-load
--tape-name "Total Eclipse & The Sphinx Jinx - The Sphinx Jinx.tzx"
--tape-sum ca4458b00be6bbea7ee05e316e24e250
--start 27228
User avatar
SkoolKid
Manic Miner
Posts: 414
Joined: Wed Nov 15, 2017 3:07 pm

Re: A library of tap2sna.py recipes

Post by SkoolKid »

Stu wrote: Sat May 13, 2023 1:48 am Looks like you've got all the ones I did anyway, although I used the TZX of Total Eclipse: The Sphinx Jinx instead of the TAP so I don't know if it's still useful?
Yep, definitely. I prefer a TZX whenever one is available.
SkoolKit - disassemble a game today
Pyskool - a remake of Skool Daze and Back to Skool
Post Reply