boriel.com

Hacks, science and curiosities

The ZX BASIC Compiler

I finally achieve it!! The ZX Spectrum BASIC compiler does really work! šŸ˜‰ Yes, my first home computer was the ZX Spectrum 48K, as you surely have already guessed and it left an impressive mark on my soul.

As a child, one of my dreams was to write a compiler for this machine; to have the power of transform the slow ZX Spectrum BASIC to Machine Code, and to be able to develop games or other interesting programs without having to deal with assembler language.

And so the years passed, my ZX Spectrum grew old and disappearedā€¦ šŸ™ but not that dream of making up my own Spectrum BASIC Compiler. Due to my lack of knowledge at first (I studied Computer Sciences at the university) and the lack of time later it was not possible to me to make it until today (and yes, Iā€™m a bit thrilled). šŸ™‚

If you ever wanted your BASIC programs to be fast, I encourage you to give it a try. Brief Information

Ok, If youā€™ve reached here, you are probably interested. Read this, please:

What is it exactly?

Itā€™s an SDK entirely written in python (using PLY as LALR parser) which runs on your PC.

What does it do?

You write a program in a BASIC dialect using your preferred text editor, and this program translates it into ZX Spectrum (Z80) machine code.

Which platforms does it run on?

It runs on every platform where python does. This includes, of course, Linux, Windows and Mac. It only requires you to have installed the python interpreter in your computer. For Windows thereā€™s also a .MSI installer version which does not requires python, since it is already bundled with the compiler

How do I transfer the program to my Speccy?

There are several ways. This tool allows you to create .bin and .tzx files. To test your program you can use a ZX Spectrum emulator (there are tons of them on the internet). You can also convert your TZX program to .MP3 or .WAV and record it on a CD or cassette, to load it as you always did! šŸ˜‰

Where can I find out more?

There are two main sites: The Wiki (in English) and the forum.

Where can I ask for help?

At the forum created for that, and also at the Speccy forum.

Where can I download it?

Go to the download page to get the most recent version.

For more info, please visit the Wiki F.A.Q section. I will put some tutorials there in a short period of time. The compiler keeps developing and extending, until I reach my next goalā€¦