Targets supported by ugBASIC

Commodore 128 (using Zilog Z80) (c128z)

The c128z target has been supported by ugBASIC since version 1.14. The compiler can produce executable files in "prg" format.

How to start

You can use the SANDBOX to try the ugBASIC compiler, without download anything. This tool has been designed to quickly test whether the code you are writing compiles correctly and determines the desired results.

Since the source is compiled thanks to dedicated servers, separate from the browser you are using, some commands are not available: for example, you cannot load external files or resources by using the LOAD command.

If you need to develop a program with a complete tool, we recommend installing the command line executables (see below) or UGBASIC-IDE.

To write the source code you can use a simply text editor. You can save the program in a text file and then to call the compiler, in order to convert it into an form that your Commodore 128 (Zilog Z80) will be able to execute.

Otherwise you can download and use command line compilers. Here are the direct links to the compilers for the various operating systems. Select the most suitable one for your configuration:

In addition to compiling with the IDE, if you are using Linux or the command line version for Microsoft Windows, you can compile the BASIC source "source.bas" into an executable file using the following command:

ugbc.c128z -o executable.prg -O prg source.bas

It is therefore possible to run everything with an emulator, such as VICE , or to create a phisical storage, as well.

A good starting point to learn ugBASIC for the c128z platform is the examples page. The examples provide insight into the syntax and usage of many of the commands and statements available for the language.

Since ugBASIC is an isomorphic language, which does not provide abstractions, it is possible that not all examples work on all targets: those labeled c128z can be compiled to generate executable files.

If you need help and support, the best place is the official forum, where you can find answers to your questions and receive help.

Games written for Commodore 128 with Zilog Z80 (more...)


This game is a "Connect Four" clone. The objective of the game is to be the first to form a horizontal, vertical, or diagonal line of four of one's own tokens.

Examples for Commodore 128 with Zilog Z80 (more...)




Plotting and graphic modes

The ugBASIC language provides access to all documented graphics modes of the VDC chipset, that can be selected using the SCREEN # command, and used with graphics primitives. This is the value of the various constants in the various versions:

0Text Mode80x25x8
1Bitmap Mode640x200x1

Blitting images

Blitting operations are partially supported.

Calling and inlining assembly code

With the c128z target you can include assembly code for the Zilog Z80 processor. The code will be placed within the code bank.

Supported video standard

The ugBASIC compiler supports both the Commodore 128 PAL (working frequency: 50 Hz) and NTSC (working frequency: 60 Hz) versions, and automatically detects the working frequency to calibrate the delays. The current implementation does not provide any support for VBL-related interrupts, which are not handled in any way. An issue is currently open to add support.

Audio support

The c128z target does not supports currently audio commands.

Joystick and keyboard support

The ugBASIC language does not supports any joystick, and it supports only the keyboard.