Targets supported by ugBASIC

(classic) Game Boy) (gb)

The gb target has been supported by ugBASIC since version 1.17. The compiler can produce executable files in "gb" signed cartidge 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 Nintendo Game Boy 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.gb -o executable.gb -O gb source.bas

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

A good starting point to learn ugBASIC for the gb 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 gb 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 Game Boy (more...)

At the moment there are no complete games for this target,
or the games are in the testing phase.

Examples for Game Boy (more...)


















Plotting and graphic modes

Bitmap mode is not supported.

Blitting images

Blitting operations are not supported.

Calling and inlining assembly code

With the gb target you can include assembly code for the Sharp SM83 processor. The code will be placed within the read only bank.

Supported video standard

The ugBASIC compiler supports the standard Game Boy working frequency.

Audio support

The gb target supports audio commands, as described on the documentation page.

Table of notes and frequencies

C C# D D# E F F# G G# A A# B
0 161718192122232426272931
1333537394144464952555862
26569737882879298104110117123
3131139147155165175185196207220233247
4262277293311329349369391415440465493
5522553585621659697736780830880930986
6104011011170123713111394147315601659174818461956
7208121852341247326212789291331213277344936413855
8409643694681485552435461569962426554689972827710
981928738936293621008210923109231191613107131071456414564

Joystick and keyboard support

The ugBASIC language supports the embedded joy pad, using the JOY(n) statement.