This page collects the commands and options that allow you to change the behavior
of the compiler and/or the compiled program.
Introduction
Language
Features
Hardware
The ugBASIC language allows you to modify the
behavior and parameters of the compilers, as well as the
functionality it exposes. To this end it introduces what are
called "pragmas" (or directives). In a nutshell, there are three
kind of directives:
OPTION
keyword;DEFINE
keyword;CONFIGURE
keyword.
Language directives allow you to modify the behavior of the language or compiler,
to ensure that it behaves as expected. They are all prefixed by the OPTION
keyword, and they work from the next instrucion. Below is the concise list
of options supported by the language.
OPTION | DESCRIPTION | ||||
---|---|---|---|---|---|
OPTION TYPE WIDE | Change the way ugBASIC interpret constants, possibly using the default type. See integers on datatype chapter, for a more specific explanation. | ||||
OPTION TYPE NARROW | Change the way ugBASIC interpret constants, using the minimum size type. See integers on datatype chapter, for a more specific explanation. | ||||
OPTION TYPE SIGNED | Change the way ugBASIC interpret variables and constants, allowing signed type. | ||||
OPTION TYPE UNSIGNED | Change the way ugBASIC interpret variables and constants, allowing unsigned type. | ||||
OPTION EXPLICIT OPTION EXPLICIT ON | From this point on, ugBASIC will require that each variable or constant used has been previously defined, to be used. It will therefore no longer be possible to use variables defined "on the fly" but they will have to be, at least, defined using DIM . See variables on variables chapter, for a more specific explanation. | ||||
OPTION EXPLICIT OFF | From this point on, ugBASIC will not require that each variable or constant used has been previously defined, to be used. See variables on variables chapter, for a more specific explanation. | ||||
OPTION READ OPTION READ SAFE | From this point on, ugBASIC will will try to identify the type of data stored with the DATA instruction, and convert it into the variable type used by the READ command. | ||||
OPTION READ FAST | From this point on, ugBASIC will will store directly values with the DATA instruction, and will read it using the destination variable on READ command. | ||||
OPTION CLIP OPTION CLIP ON | Enable globally the clipping on PLOT instruction. See clipping on graphics chapter, for a more specific explanation. | ||||
OPTION CLIP OFF | Disable globally the clipping on PLOT instruction. See clipping on graphics chapter, for a more specific explanation. | ||||
OPTION CALL AS GOSUB | Use CALL as synonym for GOSUB , so that the execution will return back to the calling point (default behaviour). | ||||
OPTION CALL AS GOTO | Use CALL as synonym for GOTO , so that the execution will not return back to the calling point. | ||||
OPTION EXEC AS GOTO | Use EXEC as synonym for GOTO , so that the execution will not return back to the calling point. | ||||
OPTION EXEC AS GOSUB | Use EXEC as synonym for GOSUB , so that the execution will return back to the calling point (default behaviour). | ||||
OPTION DIALECT name | Select a specific behaviour for the compiler:
| ||||
OPTION DEFAULT TYPE type | Change the default type of variables, if not specified. |
Features directives allow you to modify the behavior of the some available
features, to ensure that it behaves as expected. They are all prefixed by
the DEFINE
keyword, and they work globally (unless specified).
Below is the concise list of defines supported by the language.
DEFINE | DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
DEFINE AUDIO SYNC | Effects and notes are played synchronously, so no need to wait for completition for executing the next command. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE AUDIO ASYNC | Effects and notes are played asynchronously, so you need to wait for completition otherwise the following commands will be executed during the sound effect/note. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE AUDIO TARGET value |
Specify the output for audio commands, allowed values for value :
|
||||||||||||||||||||||||||||||||||||||||||||
DEFINE CENTER WITH NEWLINE | Enable implict newline instruction with CENTER command if ";" is not used (default behaviour). | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE CENTER WITHOUT NEWLINE | Disable implict newline instruction with CENTER command. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE CLS EXPLICIT | Disable implict CLS instruction when resolution is changed (default behaviour). | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE CLS IMPLICIT | Enable implict CLS instruction when resolution is changed. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE COLOR EXPLICIT | The color index used into graphical commands is exactly the color to use. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE COLOR IMPLICIT | The color index used into graphical commands is one of the current supported palette. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE DOUBLE BUFFER ON | Leave only the code for the double buffer mode, if available. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE DOUBLE BUFFER OFF | Leave also code for non double buffer mode, if available. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE COMPRESSION RLE ON | Enable the RLE compression of images, if needed / allowed. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE COMPRESSION RLE OFF | Disable the RLE compression of images (default). | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE FLOAT PRECISION precision | Change the precision for float representation. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE FONT schema | Change the preloaded font for graphical modes, and modes where characters can be redefined. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE LOAD BANKED ON | Make all LOAD commands with an implicit BANKED (default only on pc128op) . | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE LOAD BANKED OFF | Make all LOAD commands without an implicit BANKED (default everywhere except pc128op) . | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE INPUT SIZE size | Change the maximum size for INPUT$() buffer. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE INPUT SEPARATOR value | Change the character used as separator. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE INPUT CURSOR value | Change the character used as cursor. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE INPUT RATE value DEFINE KEYBOARD RATE value | Change the typematic rate of keyboard input (internally converted as INPUT DELAY ). | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE INPUT DELAY value DEFINE KEYBOARD DELAY value | Change the typematic delay of keyboard input. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE JOYSTICK RETRIES number | Change the number of readings when retrieving value from analogical joystick. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE JOYSTICK SYNC | Read the position of joysticks in the moment the program asks for them. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE JOYSTICK ASYNC | Read the position of joysticks during interrupt, and read the last position detected when asked (default for c128). | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE KEY PRESS SYNC | Change behaviour of KEY PRESS , to be like the one described by manual; otherwise, it will be an alias for KEY STATE . | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE KEYBOARD SYNC | Read the key at the moment the program asks for them. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE KEYBOARD ASYNC | Read the key strokes during interrupt, and read the last key detected when asked. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE MSPRITE SYNC | Multiplexed sprites are updated synchronously, so no need to explicit call for MSPRITE UPDATE . | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE MSPRITE ASYNC | Multiplexed sprites are updated asynchronously, and updates will be visible only using MSPRITE UPDATE . | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE PALETTE PRESERVE | Enable the palette preservation on targets with limited palette. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE PALETTE NOT PRESERVE | Disable the palette preservation on targets with limited palette. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE PROGRAM START value | Change the starting address of the executable program to value .
| ||||||||||||||||||||||||||||||||||||||||||||
DEFINE PAINT BUFFER value | Change the size of buffer used as stack for PAINT instruction. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE SCREEN MODE UNIQUE | Limit the support to just one screen mode, discarding routines and data structures for the other. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE STRING COUNT count | Change the maximum number of dynamic strings that can be stored at once. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE STRING SPACE size | Change the maximum size of dynamic strings that can be stored at once. | ||||||||||||||||||||||||||||||||||||||||||||
DEFINE TASK COUNT count | Change the maximum number of tasks that will be managed using multitasking. |
In order to allow customization of the hardware, and
the possibility of generating hardware selection menus
via software. The configuration allows two types of
manipulation: a static one, which is adopted at
compilation time (useful for development and
unconventional startup) and a dynamic one, which is
adopted at execution time (useful for creating
configuration menus).
Each hardware change request must begin with the CONFIGURE
keyword followed by the name of the hardware to be configured,
that is listed in the following table.
Static changes must begin with the CONFIGURE STATIC
keywords,
while dynamic changes must begin with the CONFIGURE DYNAMIC
keywords. By default, the changes are to be considered static.
Each request for hardware modification must concern one or more
parameters prefixed by the SET
command, as present into
the following table. The value that can be assigned to these variables
must be consistent with the expected and acceptable values, as described
next to the parameter. Note that this control will only take place on
static configurations, since they must be constant. Finalli, it is possbile
to assign multiple values consecutively, separating them with a comma,
without using the SET
command.
For example, this command will configure the audio for coco target,
as the one given from Game Master Cartridge on slot 2 with SN76489:
CONFIGURE GMC SET SLOT = 2
CONFIGURE SN76489 SET ADDRESS = $FF41
CPU(s) | ||
---|---|---|
NAME | DESCRIPTION | PARAMETERS |
CPU6502 | Main CPU (MOS 6502) |
|
CPU6809 | Main CPU (MOTOROLA 6809) |
|
CPUZ80 | Main CPU (ZILOG Z80) |
|
TARGETS | ||
NAME | DESCRIPTION | PARAMETERS |
ATARI | Target Atari 400/800 |
|
ATARIXL | Target Atari XE/XL/XEGS |
|
C128 | Target Commodore 128 (MOS 8502) |
|
C128Z | Target Commodore 128 (ZILOG Z80) |
|
C64 | Target Commodore 64 |
|
C64REU | Target Commodore 64+REU |
|
COCO | Target TRS-80 Color Computer 1/2 |
|
COCO3 | Target TRS-80 Color Computer 3 |
|
COLECO | Target ColecoVision |
|
CPC | Target Amstrad CPC 664 |
|
D32 | Target Dragon 32 |
|
D64 | Target Dragon 64 |
|
MO5 | Target Thomson MO5 |
|
MSX1 | Target MSX |
|
PC128OP | Target Olivetti Prodest PC128 |
|
PLUS4 | Target Commodore Plus/4 |
|
SC3000 | Target SEGA SC-3000 |
|
SG1000 | Target SEGA SG-1000 |
|
VIC20 | Target Commodore VIC-20 |
|
ZX | Target ZX Spectrum |
|
VIDEO CHIPSET | ||
NAME | DESCRIPTION | PARAMETERS |
M6847 | Motorola 6847 |
|
ANTIC | Atari ANTIC |
|
EF9345 | Thomson EF9345 |
|
EF936X | Thomson EF936x |
|
GIME | Morotola GIME |
|
GTIA | Atari GTIA |
|
TED | Commodore TED |
|
TMS9918 | Texas Instruments TMS9918 |
|
VDC | MOS 8563 (MOS VDC) |
|
VIC1 | Commodore VIC |
|
VIC2 | Commodore VIC-II |
|
AUDIO CHIPSET | ||
NAME | DESCRIPTION | PARAMETERS |
AY8910 | General Instrument AY-3-8910 |
|
POKEY | Atari POKEY |
|
SID | Commodore SID |
|
SN76489 | Texas Instruments SN76489 | ADDRESS |
TED | Commodore TED |
|
VIC1 | Commodore VIC |
|
DISK STORAGE | ||
NAME | DESCRIPTION | PARAMETERS |
D64 | Commodore 1541 Disk Image |
|
OTHER HARDWARE | ||
NAME | DESCRIPTION | PARAMETERS |
GMC | Game Master Cartridge | SLOT |
If you have found a problem, if you think there is a bug or, more
simply, you would like something to be improved, write a topic on the official forum, or open an issue on GitHub.
Thank you!