Targets supported by ugBASIC

Commodore 64 + REU (c64reu)

The c64reu target has been supported by ugBASIC since version 1.16. The compiler can produce entire "d64" disks, to be used with real hardware, and "reu" files, that can be used in emulators.



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 64+REU 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.c64reu -o disk.d64 -O d64 source.bas
ugbc.c64reu -o image.reu -O reu 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 c64reu 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 c64reu 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.

Show case for Commodore 64 + REU (more...)



FLARE ANIMATION: USING C64+REU

This code create a video player inserting pictures into REU memory (512KB). The demo can be stored on two floppy disks. Click here to see the source code.


4GRAVITY!

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 64 + REU (more...)














Plotting and graphic modes


The ugBASIC language provides access to all documented graphics modes of the VIC-II 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:

MODEDESCRIPTIONWIDTHxHEIGHTxCOLORS
0Standard Character Mode40x25x2
1Multicolor Character Mode40x25x16
2Standard Bitmap Mode320x200x2
3Multicolor Bitmap Mode160x200x4
4Extended Multicolor Character Mode40x25x20

Blitting images


Blitting operations are supported.

Calling and inlining assembly code

With the c64reu target you can include assembly code for the MOS 6502 processor. The code will be placed within the code bank.

Supported video standard

The ugBASIC compiler supports both the Commodore 64 PAL (working frequency: 50 Hz) and NTSC (working frequency: 60 Hz) versions, and automatically detects the working frequency to calibrate the delays. In particular, it defines two constants with the same name, and initializes the constant TICKS PER SECOND.

This is the value of the various constants in the various versions:

VERSIONENTSCPALTICKS PER SECOND
c64 PAL0 (FALSE)-1 (TRUE)50
c64D PAL0 (FALSE)-1 (TRUE)50
c64DR PAL0 (FALSE)-1 (TRUE)50
c64 NTSC-1 (TRUE)0 (FALSE)60
c64D NTSC-1 (TRUE)0 (FALSE)60
c64DR NTSC-1 (TRUE)0 (FALSE)60

Audio support

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

Table of notes and frequencies (PAL version)

C C# D D# E F F# G G# A A# B
0 000000000000
10000000000016
2171819202122242526283031
3333537404245475053565963
467717579848994100106112119126
5133141150159168178189200212225238252
6267283300318336356378400424449476504
75345665996356737137558008488989521008
8106811321199127013461426151016001695179619032016
921362263239825402691285130213201339135933806

Joystick and keyboard support

The ugBASIC language supports up to 2 joysticks, using the JOY(n) statement, and the keyboard.