Working with the IDE
ZXBASIC Integration

ZXBASIC Integration

Klive IDE supports ZXBASIC out-of-the-box. After setting up ZXBASIC integration, you can use Klive IDE to edit and run ZXBASIC programs.

Note: The current version of ZXBASIC does not provide debug information, so source code debugging is not available with the IDE yet.

As Klive IDE does not know where to find the ZXBASIC compiler on your machine, you must set it up before using it.

Setting up ZXBASIC

You need to download and install ZXBASIC (opens in a new tab). Note the installation folder; you will need it to set up the integration with Klive.

The IDE provides a command, zxb-reset (or shorter, zxbr), to connect Klive with ZXBASIC. You can issue this command from the Command window:

ZxbReset

The command expects one to three parameters:

  • The path to the ZXBASIC compiler (required)
  • The path to access the Python interpreter (optional; you may need it on Mac and Linux)
  • The machine code origin address (optional, $8000, if omitted)

Note #1: The ZXBASIC compiler is a Python script, so you need to have Python installed on your machine. On Windows, the IDE can find the Python interpreter automatically. On Mac and Linux, you must provide the path to the Python interpreter.

Note #2: You can learn more about how settings are stored.

Windows Integration

Windows 10 and 11 usually install Python with the OS. If not, you can install Python from here (opens in a new tab). ZXBASIC requires Python 3.10 or higher. The installer adds its folder to the PATH environment variable, so you can use zxb-reset with a single command parameter:

zxb-reset <full path to zxbc.exe>

When you define the path, you should provide the reference for the zxbc.exe file within the folder. For example, if you installed ZXBASIC into the C:\Users\joe\zxbasic folder, use this command:

zxb-reset C:\Users\joe\zxbasic\zxbc.exe

When you have a space anywhere in the path, wrap the path into double quotes:

zxb-reset "C:\My folder with spaces\zxbasic\zxbc.exe"

MacOS Integration

On MacOS, use the zxb-reset command with a full path to the zxbc.py file, like in this example:

zxb-reset /Users/joe/zxbasic/zxbc.py

Most of the time, you must also specify the Python interpreter path:

zxb-reset /Users/joe/zxbasic/zxbc.py /opt/homebrew/bin

Note: You can find the path of the Python installation with the which python3 command. Do not forget that the last segment is the python3 executable; you should omit it from the path specification.

Linux Integration

I have not tried to integrate Klive IDE with ZXBASIC on Linux. If you did and have a helpful description of the integration steps, please create a PR to extend the installation notes in this article.

Using ZXBASIC

Klive IDE considers files with .zxbas extension to be ZXBASIC source files. When you open such a file in the code editor (select a file in Explorer), the IDE applies the syntax highlighting of ZXBASIC.

When you create a new project, by default, the code/code.kz80.asm file is the build root. However, when you right-click the code/program.zxbas file and use the Promote build root command, this file becomes the new build root. From now on, you can use the commands in the document tab toolbar when the program.zxbas file is open.

ZxbasActions

You can use the toolbar buttons to compile, inject, start, or debug the code as described in this article .

When you run the ZXBASIC code in the default Klive project template, you can see the result in the Emulator window:

ZxbRunning