Spectrum game disassembly toolkit

Zone of contention

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

Continuing the theme of “more 128K support” that started in 9.0, this release does indeed bring more 128K support. Specifically, can now create 128K snapshots, can create 128K TAP files, can create 128K binary files, can modify 128K snapshots, and skool files can create internal 128K memory snapshots.

I think most of that was self-explanatory, but perhaps the internal 128K memory snapshots in skool files need a little more explanation. The new @bank directive either specifies the RAM bank mapped to 49152 (0xC000), or loads the contents of another skool file into a 128K RAM bank - and converts the snapshot to 128K at the same time. When that happens, the 128K ROM is loaded as well. After that, how do you actually access all the extra memory? Enter the new #BANK macro, which switches the RAM bank that is mapped to 49152. Got a sprite in RAM bank 4 you’d like to create an image of? Do a quick #BANK4 and you’re ready to go.

One other thing about not only can it now modify 128K snapshots, but it can also modify SZX snapshots. That brings it up to par with its friends, and, which gained the ability to write SZX snapshots in the previous release.

In other news, SkoolKit’s Z80 instruction set simulator has gained the ability to simulate memory and I/O contention. It’s much slower when this feature is enabled, but it can be useful for various reasons. For example, there are a few game tapes out there that require it in order to LOAD correctly (the original release of Gold Mine being the quintessential example), so can certainly benefit from it. For another example, the sound created by routines running in contended memory can now be captured precisely by the #AUDIO macro (instead of being approximated in post-processing). And finally, the #TSTATES macro can now do its job accurately when presented with code that’s subject to contention.

On the subject of #AUDIO and #TSTATES, those two macros can also now simulate the execution of interrupt routines, for extra faithfulness to the behaviour of the original hardware. In the case of #AUDIO, this means its two post-processing options (approximating contention and interrupt delays) are now redundant when simulating code execution.

In case you were wondering, yes, of course the #SIM macro has not been left out when it comes to memory and I/O contention and interrupts. It also now has parameters for specifying the value of the simulator’s clock, the interrupt mode, and whether interrupts are enabled. In addition, if the stop parameter is omitted, all other parameters are evaluated, but no code is executed. This technique can be used to prepare the simulator with the required initial register values and hardware state for later use by #AUDIO or #TSTATES.

And that’s about it. Anyone wanting more information on the the new features and bug fixes in SkoolKit 9.1 should pop over to the changelog. After that, go and get your copy of 9.1 and enjoy contending memory and switching RAM banks until the cows come home.

128K ought to be enough for anyone

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

Yes, the 8.x series has come to an end. It had a good four-year run, but now’s the time for it to step aside and let 9.0 in. As you might expect from an N.0 release, there are some compatibility-breaking changes, which you can read about in the migration guide. But unless you were particularly fond of the #DEFINE macro (deprecated since 8.5), there’s not much to worry about. Most of the other breaking changes are in and, but I hope you’ll agree they’re all changes for the better.

The main new feature in this release is support for the (original) 128K Spectrum in and That is, can load 128K games from tape, and save 128K snapshots. And can then execute code in those 128K snapshots (or any other 128K snapshots you care to throw at it). The t2sfiles repository (a collection of ready-made argument files) has already celebrated this new capability by including over 1400 recipes for 128K games, which now accompany the more than 11000 recipes for 48K games.

The next most important feature in this release is support for a ‘phantom typist’ in Now, the right-minded among you will surely agree that there are few things more annoying in this world than a tape that requires something other than LOAD "" (or LOAD ""CODE) in order to LOAD and RUN correctly. Unfortunately for us, quite a few such tapes exist out there, but the phantom typist is here to help: it can enter a custom command line before starting the tape. For example:

$ -c 'load=CLEAR 35000: LOAD ""' Tridex.tzx

And perhaps the third most important feature in this release is support for writing SZX snapshots, which has been added to, and Until this release, SkoolKit’s one and only output snapshot format of choice was Z80, because it’s well supported by other software and adequate for most purposes. But occasionally runs into a deficiency in the Z80 format: it has no slot for the last OUT to port 0xFE. This value actually matters for some games that have poorly written keyboard-reading routines.

And there I shall stop, and advise any readers who want more information on the the new stuff in SkoolKit 9.0 to consult the changelog. After that, go and grab a copy of 9.0 and enjoy the 128K’s worth of goodness within.

No rest for the simulated

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 has since 8.7 came out in October last year. So, to the fans of that are still reading: strap in.

First up is the finish-tape simulated LOAD configuration parameter, which (when set to 1) forces 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 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 will do just that:

$ --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 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, 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’ ( 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.