Tracing with a screen near you
SkoolKit 9.4 has been released. To get a copy, please head over to the download page, the Python Package Index, or GitHub.
With the 9.x series well under way, and full 128K support (9.0 and 9.1), RZX support (9.2) and PZX support (9.3) now firmly entrenched, 9.4 quite reasonably steps down a gear and modestly introduces some minor enhancements to the Skoolkit commands and skool macros that we have come to know and love.
First, the --screen
option of trace.py
. As its name suggests, it displays
the contents of the Spectrum’s screen while code is executing (so long as you
have pygame installed). This can help if you want to
produce a snapshot at a particular point that’s easier to judge by eye than by,
say, the number of instructions executed (--max-operations
) or the number of
T-states elapsed (--max-tstates
).
By default, the screen is refreshed at a rate of 50 frames per second (i.e.
normal Spectrum speed), but that can be changed by setting the ScreenFps
configuration parameter. A value of 0 sets trace.py
(and screen updates)
running at maximum speed. Also by default, the screen is rendered with a scale
factor of 2 (i.e. 512x384 pixels), but that can also be changed by setting the
ScreenScale
configuration parameter.
In addition to writing a snapshot file or WAV file after code execution has
completed, trace.py
can now write a PNG image file of the screen contents.
Or, indeed, all three at the same time, now that multiple output file arguments
are allowed. By default, the image scale factor is 2 (i.e. 512x384 pixels
again), but that can be changed by setting the PNGScale
configuration
parameter.
In other command news, skool2bin.py
can now read configuration from
skoolkit.ini, and can also pad its output with zeroes on the left by using
the PadLeft
configuration parameter, or (perhaps more usefully) on the right
by using the PadRight
configuration parameter. So if PadRight
is set to
65536, you can (for example) use bin2sna.py
on the output of skool2bin.py
without ever having to specify the origin address.
Turning now to skool macros, this release bestows upon #FOREACH
support for
a new special variable: POKEname
. This expands to a list of the POKEs made
by the #POKES
macro on the named snapshot created by the #PUSHS
macro. For
example, if the udgfix
snapshot has three POKEs:
#PUSHSudgfix #POKES30000,1;30001,2;30002,3 #UDG30000 #POPS
then:
#FOREACH(POKEudgfix)(p,p,: )
would expand to:
POKE 30000,1: POKE 30001,2: POKE 30002,3
Individual POKEs and subsequences of POKEs on a snapshot can be specified by
using Python’s square brackets notation for indexing ([i]
) and slicing
([start:stop]
) a list. For example, POKEudgfix[0]
yields the first POKE,
and POKEudgfix[1:]
yields every POKE but the first.
There are more new features to discover, but for details on those and the bug fixes in SkoolKit 9.4, head over to the changelog. When you’re finished there, get a copy of 9.4 and start rendering POKE lists with absolute precision.