Targets supported by ugBASIC

TRS-80 Color Computer 1/2 (coco)

The coco target has been supported by ugBASIC since version 1.13. The compiler can produce executable files in "bin" format and entire "dsk" disks, including files that can be loaded using the language's primitives.



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 TRS-80 Color Computer 1/2 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.coco -o executable.bin -O bin source.bas
ugbc.coco -o disk.dsk -O dsk source.bas

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

A good starting point to learn ugBASIC for the coco 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 coco 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.

Plotting and graphic modes


The ugBASIC language provides access to all documented graphics modes of the Motorola 6847 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
0Alphanumeric Internal32x16x2
1Alphanumeric External32x16x2
2Semigraphics 464x32x8
3Semigraphics 664x48x4
7Color Graphics 164x64x4
8Resolution Graphics 1128x64x2
9Color Graphics 2128x64x4
10Resolution Graphics 2128x96x2
11Color Graphics 3128x96x4
12Resolution Graphics 3128x192x2
13Color Graphics 6128x192x4
14Resolution Graphics 6256x192x2

Blitting images


Blitting operations are supported.

Calling and inlining assembly code

With the coco target you can include assembly code for the Motorola 6809 processor. The code will be placed within the code bank.

Supported video standard

The ugBASIC compiler supports both the TRS-80 Color Computer 1/2 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:

VERSIONNTSCPALTICKS PER SECOND
Tandy CoCo (PAL)0 (FALSE)-1 (TRUE)50
Tandy CoCo (NTSC)-1 (TRUE)0 (FALSE)60
Tandy CoCo 2B (PAL,T1)0 (FALSE)-1 (TRUE)50
Tandy CoCo 2B (NTSC,T1)-1 (TRUE)0 (FALSE)60

Audio support

The coco target does not supports audio commands.

On the beta version, the ugBASIC music system allows soundtracks in background to be added to any program. Music can be created from a variety of sources, including MIDI and PSG files. The ugBASIC support SN-76489 audio chipset used by external soundcard attached, like the Game Master Cartridge.

The audio card is properly emulated by the latest version of XROAR emulator. If you are generating binary images, you can use directly with this command line:

xroar -machine coco -cart gmc program.bin

If you are using a disk image, you need to use a MPI (Multi Pack Interface), to attach both Game Master Cartridge (slot 0) and RS-DOS (slot 3). You should use this command line:

xroar -machine coco -cart mpi -mpi-load-cart 0=gmc -mpi-load-cart 3=rsdos -mpi-slot 3 program.dsk

Click here to know more.

Joystick and keyboard support

The ugBASIC language supports up to 2 joysticks, using the JOY(n) statement, and the keyboard. The left joystick is in port 0, while right joystick in port 1.

Games written for TRS-80 Color Computer 1/2 (more...)



ACME, inc. (10 liner)

This game is a multitasking arcade game for one player. The aim of the game is to make the coyote run for as long as possible, avoiding the barrels that roll towards him. The more barrels you avoid, the higher the score. It is a self-competiting game, and it is designed for one player. This game joins the "BASIC10Liner" competition 2024


FALLING BALLS (10 liner)

This game is a multitasking arcade game for one player. The player must drop balls into the baskets at the bottom of the screen, in the shortest possible path. The longer the ball travels across the screen, the fewer points he/she accumulates This game joins the "BASIC10Liner" competition 2024


PICK THE STAR (10 liner)

This game is a multitasking arcade game for one player. The player must pick mostly the stars that descend from the top of the screen, because they give to the player the higher score. This game joins the "BASIC10Liner" competition 2023


TIC-TAC-TOE (10 liner)

This game is a traditional paper-and-pencil game for two players who take turns marking the spaces in a three-by-three grid with X or O. This game joins the "BASIC10Liner" competition 2023


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 TRS-80 Color Computer 1/2 (more...)