SkoolKit 8.10 has been released. To get a copy, please head over to the download page, the Python Package Index, or GitHub.

As the title suggests, this release of SkoolKit is (again) almost entirely about Z80 instruction set simulation. And to rub salt in the wounds of those who still have no interest in the subject, it’s specifically about Z80 instruction set simulation in the service of LOADing tapes. To my recollection, never has a single SkoolKit command received so much attention over a sequence of releases as tap2sna.py has since 8.7 came out in October last year. So, to the fans of tap2sna.py that are still reading: strap in.

First up is the finish-tape simulated LOAD configuration parameter, which (when set to 1) forces tap2sna.py to play the tape to the end before stopping the simulation at the given start address. This is particularly useful for custom loaders that hit the start address more than once during the loading process, and also for stopping purely ROM-based loaders at $053F (SA/LD-RET) after the last block on the tape has loaded.

Next is the contended-in configuration parameter, which (when set to 1) makes tap2sna.py interpret ‘IN A,($FE)’ instructions in the address range $4000-$7FFF (i.e. contended memory on a standard 48K Spectrum) as reading the tape. Lest you think this couldn’t possibly be useful, it’s actually required by such games as Fly Swatter, Removal Deluxe and Sapper, all of which have custom loading routines located in the aforementioned address range.

After that, there are 32 new tape-sampling loop accelerators in this release, brought in to accompany the original 11. And although the casual user will rarely need to think about them, if you are curious which accelerators (if any) a game uses, you can now set the accelerator simulated LOAD configuration parameter to list, and tap2sna.py will do just that:

$ tap2sna.py --sim-load -c accelerator=list GYROSCP2.TZX gyroscope2.z80
Program: GYROSC.II
Fast loading data block: 23755,1250
Data (602 bytes)
Data (46414 bytes)
Tape finished
Simulation stopped (end of tape): PC=64809
Accelerators: rom: 12857; speedlock: 113290; bleepload: 632000; misses: 25/62
Writing gyroscope2.z80

The Accelerators line here shows that a rom-style tape-sampling loop was entered 12857 times, a speedlock-style loop 113290 times, and a bleepload-style loop 632000 times. In addition, the tape-sampling loop detectors, which are triggered by ‘INC B’ and ‘DEC B’ instructions, counted 25 misses for ‘INC B’ (i.e. 25 instances of ‘INC B’ not inside a recognised tape-sampling loop) and 62 misses for ‘DEC B’.

For those even more curious about custom loaders, the format of the trace log file produced by tap2sna.py during a simulated LOAD can now be defined via the TraceLine and TraceOperand configuration parameters. In addition to the current address and instruction, you can log the current value of any register, and also the current time (in T-states) as recorded by the simulator’s internal clock. In conjunction with the new --tape-analysis option of tap2sna.py, which provides an analysis (including timestamps) of a tape’s tones, pulse sequences and data blocks, this enables you to figure out what’s being loaded and where at any point in the loading routine. If that’s your kind of thing.

But if all of this so far seems like too much information, and all you want is for --sim-load to just work for a particular tape, you could do worse than consult the t2sfiles repository. It contains ready-made ‘t2s’ (tap2sna.py argument) files for thousands of games, with appropriate start addresses already figured out, and appropriate accelerators already specified.

And on that note, I shall direct any readers who want even more information on the goodies (simulation-related and otherwise) inside SkoolKit 8.10 to the changelog. When you’re done there, please download a copy of 8.10, and perhaps a copy of the t2sfiles repository, and give --sim-load a good workout. For real this time.