Turbo Maker 1.0
By Lee Tonks
(C)2004, Cheese Freak Software
Instructions slightly redone in 2007 for WOS upload


Introduction
------------
Waaaaaaaaaaaaaaaaaaaaaaaaaay back when in the 'good old days' before Bill and
Windows and everything, computers were great. Especially my trusty Spectrum,
which I still love dearly. Sadly, loading games wasn't so great - we only
really had tapes and it took ages. At some point in the dim and distant past,
I discovered an article in Crash magazine which talked about how to alter the
ROM using a Multiface and its 'shadow' memory. One of the things it described
was how to alter the ROM load and save routines to speed them up - effectively
a cheap and cheerful turbo-loader. 

That very article is here, if you're interested:
http://simon.mooli.org.uk/AF/article/TechTips31.html

Fascinated, I made it work. Then I figured it would be great to use the same
principles to make a 'proper' turbo loader which could be loaded anywhere in
memory without a multiface. So that's what I did! I also created a BASIC
'creator' program which would generate a custom turbo-loader for you.

A while back, I rediscovered this and used it to make a turbo-load version of
my Manic Miner remix, Tales From A Parallel Universe. I then decided to
release the creator program to the world, but... discovered it was a bit crap.
I decided to rewrite it, and Turbo Maker is the result.


Prerequisites
-------------
WARNING: This is not a tutorial for the absolute beginner. I'm presuming at 
least a reasonable understanding of some things. The program will not do 
'everything' for you, it's a tool to allow you to do some things more quickly.

You must have:
a) A Spectrum, or an emulator (one that lets you save TZX files preferably)
b) Something that you want to add a turbo-loader to
c) At least a modicum of techie know-how about how Spectrum tapes work

I've only tried to use these loaders with machine code programs. I've no idea
how you could get them to work with BASIC files. If anyone finds out, let me
know and I'll add it here.


How to use it
-------------
The program runs on a Spectrum. It should run on ANY Spectrum, but I can't
prove that.

Load the TZX file into your emulator and/or real hardware. You'll note that
it is turbo-load... the loader it uses is one generated by the program itself.
Be careful not to end up in a paradox trying to figure that out. :-)

After loading, you have two options: make a loader, or make a saver.


Save Routines
-------------
The easiest of the two. You must know the start addresses and lengths of the
data you want to save. Ask the program to create a save routine and you end up
at a blank screen with three options. Select these as required to build the
'template' for your save routine:

1) Save
Tells the program about a block of data you want to save. You'll be prompted
for various bits of info about that data.

2) Any Key
Puts in a 'pause 0' so that you can leave gaps between saved blocks of data.

3) Return
Adds a 'RET' command to the end. You must have one of these! Selecting this
option will complete the 'plan' for the save routine.


After this you will be prompted with a few general questions about the routine
you want to create:

Speed:
The speed of saving. Choose 0% to go with standard Speccy 1500 baud. 20% is
about 1800 and 50% is about 2250.

Memory address:
This is where the routine will be loaded in memory. Choose somewhere ABOVE
32767 and out of the way of your data. Routines will not work properly below
32768 as this is contended memory and the timings get shot to pieces.

Filename:
What to call the routine when saving to tape.


After saving, you'll be given information about how to reload your save
routine and how to execute it.


Load Routines
-------------
A bit more complicated. Again, you must know the start addresses and lengths
of the data you want to load. Ask the program to create a load routine and you
end up at a blank screen with six options. Select these as required to build
the 'template' for your load routine:

1) Load
Tells the program about a block of data you want to load. You'll be prompted
for various bits of info about that data.

2) Call
Tells the program you wish to 'call' a machine code routine at a particular
address. Control will return to the loader upon that routine 'RET'ing. Handy
for running compression routines, copying stuff to the screen, etc.

3) Any Key
Puts in a 'pause 0'. I like to have these at the end of loading so that you
can admire the loading screen before the game starts. :-)

4) 128k Page
Switches in any of the 128's memory banks (0 to 7). Don't forget to switch
back later if you need to!

5) Jump
Ends the load routine and jumps to a memory address - usually to start the
game running. Selecting this option will complete the 'plan' for the load
routine.

6) Return
Adds a 'RET' command to the end, which can potentially return you to BASIC
after loading is complete. Selecting this option will complete the 'plan' for
the load routine.


After this you will be prompted with a few general questions about the routine
you want to create:

Disable Break:
Want to stop people hitting BREAK and busting things up? You can do that here.

Choose colour scheme:
The really interesting bit. You can choose from eight different colour schemes
for the loading lines. Some look awful. :-)

Speed:
The speed of the loader. Choose 0% to go with standard Speccy 1500 baud. 20%
is about 1800 and 50% is about 2250. Must match the option you chose when you
saved the data in the first place!

Memory address:
This is where the routine will be loaded in memory. Choose somewhere ABOVE
32767 and out of the way of your data. Routines will not work properly below
32768 as this is contended memory and the timings get shot to pieces.

Filename:
What to call the routine when saving to tape.


After saving, you'll be given information about how to reload your load
routine and how to execute it.


So.... how do you go about adding a loader to something?
--------------------------------------------------------
Briefly, it goes something like this:

1) Find out what blocks of data are in your game, how big they are and where
they are loaded in memory.

2) Generate load and save routines for these blocks. You might need to make
multiple save routines, but you should be fine with a single loader. Save them
off to tape.

3) Create a BASIC loader which loads your load routine and executes it.

4) Save the load routine after the BASIC loader.

5) Load the game blocks in turn and save them onto the 'final' tape after the
BASIC and loader blocks.

6) Repeat until finished.


I don't have a real Speccy.... can I cut out the middle man?
------------------------------------------------------------
Yes! In fact, it's almost easier to do the whole business on your PC than it 
is to do it with the real machine. Why? You don't need to create a save 
routine - you can just use Taper or Tapir or some other TZX editor to change 
the loading speed of the data directly and then tag a new loader onto the 
front. 

For instance, looking at a TZX file containing just a loading screen in Tapir 
shows two blocks - the header and the actual 'standard speed' data. Delete the 
header block (the turbo loader neither needs nor understands them anyway), 
then select the remaining block. Change the drop-down from 'standard speed' to 
'turbo speed', then rejig the values in the boxes according to the speed you 
want to use: 

20% faster:
Sync Pulse 1: 714
Sync Pulse 2: 714
Zero Pulse: 693
One Pulse: 1386

50% faster:
Sync Pulse 1: 714
Sync Pulse 2: 714
Zero Pulse: 573
One Pulse: 1147

(I got those values by saving the data from Turbo Maker save routines to a WAV 
file and running them through MakeTZX - that's the other way to do this all on 
a PC, but it's not nearly as fast and neat as editing the TZX directly.) 

Save the changes. Then, use your favourite emulator and Turbo Maker to create 
a load routine, tag a BASIC loader on the front, and save the lot to a second 
TZX. Merge the two together and voila! Instant turbo data without having to 
much around with tapes and stuff. 


That's all very well, but I don't have enough free memory to fit a loader in!
-----------------------------------------------------------------------------
That may very well be true. However, all is not lost. You can very often 
increase the speed of loading even further by compressing your data first. The 
data loads faster because there's less of it, and compression usually creates 
the space you need at the end of memory to fit a turbo loader in too. Result! 

There are quite a few data compressors available for the Speccy, but I 
recommend giving Turbo Imploder a go because it has a nice, friendly 
Speccy-driven interface to guide you through the whole compression business. 

http://www.worldofspectrum.org/infoseekid.cgi?id=0008273


Anything else I should know about?
----------------------------------
Just one thing. I don't remember ever testing the 128k paging option in Turbo 
Maker. So it might not work. Sorry if it doesn't. :-) 


