Nostalgic 8-bit Turbo Loader for Amstrad

I have always loved Sinclair ZX Spectrum‘s characteristic tape loading method using yellow/blue stripes in the border. Contrary to Amstrad CPC‘s humble block-by-block loader with no visual feedback on screen, Spectrum offered a feast for the eye! So sexy, so catchy…

A bit of History

Major game developers/publishers of the 80s (Ocean, US Gold, Gremlin Graphics, Firebird, etc.) used turbo loaders on Amstrad by imitating the landmark tape loading system that Spectrum had introduced, not only for visual attraction but also for software protection. For the average user, it was very hard to duplicate Amstrad games released with custom turbo loaders. Some of these loaders were even capable of displaying a countdown timer and/or playing music while loading the game data. Thanks to the same CPU (Z80) used on both Amstrad and Sinclair, some of these loaders were cross-platform solutions. Speedlock, Alcatraz, Gremlin Loader and Bleepload were amongst these custom loaders.

Nostalgic coding

A few years ago, I’ve written a tutorial (in Turkish) on coding a turbo loader in Z80 assembly language for Amstrad CPC home computers, demystifying the secrets behind the custom loaders of 8-bit era. Last year, it was released as an article on Retrojen, a retro-fanzine published in Turkey.

Although I’ve written the original turbo loader routine way back on December 24, 2010, I’m releasing the source codes, today!

For clarification purposes, I have tried to keep the code as simple as possible, and written descriptive inline comments where necessary. – (So, the code is not optimized for size/speed.)

These source code files are exactly the same files published in my article on Retrojen. With respect to editor-in-chief’s kind request, I am not putting a scan/screenshot of this article on my blog. It is only available as a printed material… No worries, you can always subscribe to this lovely fanzine. It is FREE!

Time to rewind the cassette tape!

My turbo loader tutorial/source files covers the following features:

      • Using 2-colour stripes in the border (like an old Speccy),
      • Displaying a bitmap based countdown timer (so that you can use your own fonts),
      • Incremental raster scanning (no skipping lines, just displaying one after another).

There are 3 different source code files for this project:

– jScreenDump_16k_Mode1_Flat.pde: This is a very simple routine that I’ve written in Processing. (Yes, I love Processing! It is a great tool for writing quick and dirty routines without hassling details). This routine imports the .BMP file that you want to use as a title screen, and exports the image in .SCR format.

– jCDT_Generate.pde: This routine, again written in Processing, simply imports the .SCR file that you’ve created above, and generates a tape image in .CDT format.

– TurboLoader.asm: This is the turbo loader routine written in Z80 assembly language. You will assemble the code and execute it on your Amstrad (or WinAPE emulator).

If it sounds complicated, please have a look at this data flow diagram. It’s very simple, actually…

Let’s see the demo!

In case you want to skip all details above, and see a quick working demo on WinAPE emulator;

    • Start WinAPE
    • Press F3 – (view the Assembler window)
    • Open TurboLoader.asm file
    • Press F9 – (assemble & run the code), and press OK.
    • Select File > Tape > Show Tape Control from the menu
    • Click Open button, and select TurboTitleScreen.cdt file
    • Press Play on the Tape Control window – Voilà!

Don’t forget to turn up the volume for nostalgic buzz 😉

5 thoughts on “Nostalgic 8-bit Turbo Loader for Amstrad”

  1. Hello Mert, thanks for posting this code – this is really helpful!
    I have one query though. The pulse detector routine does not seem to check for a polarity change. Would this be an issue if the CDT image is to be transferred to real cassette media? The Amstrad firmware guide for the cassette system (http://www.cpcwiki.eu/imgs/5/5d/S968se08.pdf (section 8.3))
    suggests that it is possible that there can be a polarity change (bit inversion) when reading recorded data.

    1. Thanks for your kind comment! I’m glad you liked it 🙂

      Although we are not using firmware calls in this code, what the firmware guide dictates is absolutely true. Both measuring time and checking for polarity changes are essential for a “typical” Amstrad CPC tape loading procedure.

      In our case, we bypass the firmware and directly access the ports. The code handles measuring time issue in Proc_LoadOneByte function, and checks for pulse edges by calling Proc_GetPulseEdge for each byte read from the tape. The Proc_GetPulseEdge function sequentially checks for sign changes (by detecting pulse edges), jumps to pPOS/pNEG accordingly, and sets the current stripe colour.

      As far as you read the data exactly the same way you saved the CDT image on a real tape, the code should work fine.

      1. Thanks for replying. I’m going to find a tape recorder and do some testing – I’d really like experiment with these custom loaders using real hardware 🙂

        Is this loader anywhere near the maximum practical baud-rate achievable for the CPC hardware? Do you have any idea how much faster a loader like this potentially be made to go?

        1. Dear Heidelberg,

          This loader was intended to be a well-commented open source low-level tape programming guide for CPC developers, with no focus in breaking a loading speed record 😉

          Since the original Amstrad firmware has no tape input speed limit, you can do crazy things by speeding up the driven tape signal. If you really want to put the pedal to the metal, I strongly recommend checking the following links. Given the background, you don’t need turbo loaders, actually!

          http://www.cpcwiki.eu/forum/amstrad-cpc-hardware/high-speed-tape-loading/

          https://code.google.com/archive/p/otla/

          https://www.youtube.com/watch?v=9bv3d3pmA9U

          1. Hello Mert,

            Thanks for those links, very interesting. As a kid I always loved those custom tape loaders and wondered just how they worked. I’m have fun playing with the code you posted – and experimenting. Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.