atari
)
The atari
target has been supported by ugBASIC
since version 1.1. The compiler can produce both executable files in "xex"
format and entire "atr" disks, including files that can be loaded using
the language's primitives.
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 ATARI 400/800 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.atari -o executable.xex -O xex source.bas
ugbc.atari -o executable.atr -O atr source.bas
It is therefore possible to run everything with an emulator,
such as
Altirra
Atari800
,
or to create a phisical storage, as well.
A good starting point to learn ugBASIC
for the atari
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 atari 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 |
---|---|---|
2 | Graphics Mode 0 (ANTIC 2) | 40x24x1 |
3 | Antic 3 | 40x24x4 |
6 | Graphics 1 (ANTIC 6) | 20x24x4 |
7 | Graphics 2 (ANTIC 7) | 20x12x4 |
8 | Graphics 3 (ANTIC 8) | 40x24x4 |
9 | Graphics 4 (ANTIC 9) | 80x48x2 |
10 | Graphics 5 (ANTIC A or 10) | 80x48x4 |
11 | Graphics 6 (ANTIC B or 11) | 160x96x2 |
13 | Graphics 7 (ANTIC D or 13) | 160x96x4 |
DEFINE PALETTE NOT PRESERVE
or modulate the image palette to ensure that they are correctly allocated.
With the atari
target you can include assembly code
for the MOS 6502 processor. The code will be placed within the code bank.
The ugBASIC compiler supports both the ATARI 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 |
---|---|---|---|
NTSC | -1 (TRUE ) | 0 (FALSE ) | 60 |
PAL | 0 (FALSE ) | -1 (TRUE ) | 50 |
SECAM | 0 (FALSE ) | -1 (TRUE ) | 50 |
NTSC-50(*) | -1 (TRUE ) | 0 (FALSE ) | 60 |
PAL-60(*) | 0 (FALSE ) | -1 (TRUE ) | 50 |
The atari
target supports audio commands, as described on the
documentation page. However, it focuses more on
"pure tones" and uses polynomial counters only to generate a basic form of
noise. It would be useful to be able to implement more sophisticated
techniques. In this regard, an issue has been opened on github.
C | C# | D | D# | E | F | F# | G | G# | A | A# | B | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 |
1 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 |
2 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 |
3 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 |
4 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 251 | 263 |
5 | 278 | 295 | 314 | 332 | 352 | 372 | 395 | 418 | 444 | 471 | 500 | 529 |
6 | 561 | 593 | 627 | 667 | 703 | 753 | 790 | 842 | 889 | 941 | 1000 | 1067 |
7 | 1123 | 1208 | 1280 | 1362 | 1422 | 1524 | 1600 | 1730 | 1829 | 1939 | 2065 | 2133 |
8 | 2286 | 2462 | 2560 | 2783 | 2909 | 3048 | 3368 | 3556 | 3765 | 4000 | 4267 | 4571 |
9 | 4923 | 5333 | 5818 | 6400 | 7111 | 8000 | 9143 | 10667 | 12800 | 16000 | 21333 | 32000 |
10 | 64000 |