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 MSX 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.msx1 -o executable.rom -O rom source.bas
ugbc.msx1 -o executable.dsk -O dsk source.bas
It is therefore possible to run everything with an emulator,
such as
BlueMSX
,
or to create a phisical storage, as well.
A good starting point to learn ugBASIC
for the msx1
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 msx1 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.
SCREEN #
command, and used with graphics primitives. This is the value of the various constants in the various versions:MODE | DESCRIPTION | WIDTHxHEIGHTxCOLORS |
---|---|---|
0 | Text Mode | 40x24x20 |
1 | Graphic I | 32x24x16 |
2 | Graphic II | 256x192x16 |
3 | Multicolor | 256x192x16 |
With the msx1
target you can include assembly code
for the Zilog Z80 processor. The code will be placed within the code bank.
The ugBASIC compiler supports both the MSX 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:
VERSIONE | NTSC | PAL | TICKS PER SECOND |
---|---|---|---|
MSX PAL | 0 (FALSE ) | -1 (TRUE ) | 50 |
MSX NTSC | -1 (TRUE ) | 0 (FALSE ) | 60 |
The msx1
target supports audio commands, as described on the
documentation page.
C | C# | D | D# | E | F | F# | G | G# | A | A# | B | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 18 |
1 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 19 | 21 | 22 |
2 | 23 | 24 | 26 | 29 | 31 | 33 | 34 | 37 | 39 | 41 | 43 | 46 |
3 | 52 | 55 | 58 | 61 | 65 | 69 | 73 | 77 | 82 | 92 | 98 | 103 |
4 | 110 | 116 | 123 | 130 | 138 | 146 | 164 | 174 | 184 | 195 | 207 | 219 |
5 | 232 | 246 | 260 | 292 | 309 | 328 | 347 | 369 | 391 | 414 | 439 | 465 |
6 | 521 | 553 | 584 | 619 | 658 | 694 | 735 | 781 | 828 | 926 | 984 | 1042 |
7 | 1106 | 1168 | 1238 | 1316 | 1389 | 1471 | 1645 | 1761 | 1866 | 1953 | 2083 | 2193 |
8 | 2358 | 2500 | 2604 | 2976 | 3125 | 3289 | 3472 | 3676 | 3906 | 4167 | 4464 |