https://unsplash.com/@rbradyjordan







ZX BORIEL BASIC
  
ZX BASIC


When you received your ZX Spectrum you probably only saw it as a games machine, which for many it was. Once you start to think about what if you could create a game on your ZX Spectrum. For me this really started my love for programming. Started out writing the "hello world" programme which simply printed your name on screen in a loop. Soon my mind turned to "how do I do XYZ". At the time the only reference I had was the BASIC Manual and some magazines, but I turned to looking at the games I had and see if I can look at the code. Most of them were in machine code so that was no good, some had some protection to prevent you from seeing the listings. I remember looking at Football Manager and started to dabble in subroutines and even the DEF FN functions.

The big problem with BASIC was it was very slow, so any graphic games were out of the question. I also dabbled in Z80 but things for me changed and I was not able to carry on with the Z80.

I did write some games, mostly text adventure games and a strategy game.

Fast forward to the 2020s and this is where I found ZX Boriel Basic.

Simply put, you can take your basic listings and compile them into machine code! With some other tools you can then build a TAP file, which can then be loaded via emulators and even saved onto tape (I have not done that yet).



External Links for ZX BASIC

BASIC Programming book in PDF form.
https://www.funspot.it/stuff/zx-spectrum-basic-programming.pdf




  
About the ZX BASIC Project from Boriel (ZX Boriel Basic).

"
ZX BASIC is a BASIC ''cross compiler''. It will compile BASIC programs (in your PC) for your ZX Spectrum. ZX BASIC is an SDK entirely written in python. The SDK is implemented using the PLY (Python Lex/Yacc) compiler tool. It translates BASIC to Z80 assembler code, so it is easily portable to other Z80 platforms (Amstrad, MSX). Other non Z80 targets could also be available in the future.

ZX BASIC syntax tries to maintain compatibility as much as possible with Sinclair BASIC, it also have many new features, mostly taken from FreeBASIC dialect."

For more about ZX Boriel Basic head over to https://zxbasic.readthedocs.io/en/latest/

You can see an example of what can be written using ZX Boriel Basic in the downloads section under Secret Garden.


ZX Boriel Basic Complier
Resources

The following links are some of the ones that I used to start learning about how ZX Boriel Basic Complier (ZXBC) works.  Most of these come from the main wiki page but worth mentioning.

Examples
ZXBC comes with some examples of using ZXBC. that can be found under:
<installation path>\zxbasic\examples

Tutorials
https://zxbasic.readthedocs.io/en/latest/tutorials/#
There are a few of them there but the PACMAN one is a good start but be aware it does go into using Assembler but it is explained well.

Sample Programs
https://zxbasic.readthedocs.io/en/docs/sample_programs/
This contains a number of different BASIC programs, some with line numbers and some without. It shows that you can take you existing BASIC program and compile it. The others show some basic non line examples
.





Boriel Basic for ZX Spectrum: A guide for beginners…and those who are not so much



BASIC is the ideal language to begin programming, and Boriel Basic is the best option for advancing further, offering both speed and modern features.

Whether you are an enthusiast who typed some programs from magazines and haven't touched a Spectrum since then, or if you are a programmer looking to finish a game started decades ago, or simply want to learn what programming was like in the 80s, this is your book.

A comprehensive practical manual that explains the fundamental concepts with listings and examples covering, among many other things: language structure, screen, the use of sprites and tiles, advanced keyboard control, joystick, memory, interrupts, beeper and AY sound, memory paging, multicasting, and architecture. An authentic return to the 8-bit past where the limit will be your imagination.