The CHAIN command is a powerful tool used to load and execute another ugBASIC
program from mass storage (such as a floppy disk), terminating the current program.
This feature is useful on computers with limited memory, as it allows large
applications to be broken down into smaller, more manageable modules or programs
that can be "chained" together. Using CHAIN allows you to create complex
programs that would otherwise not fit entirely into the available RAM.
The CHAIN command syntax requires a filename, which should represent the binary
file located on the mass storage device. It is therefore not the name of the BASIC source
file. When this instruction is executed, the current program is overwritten with the
loaded one and executed from the beginning.
Therefore, the ugBASIC program to be called with the CHAIN command must first be
compiled into the specified binary format. Only then should this compiled file be
inserted into the STORAGE definition, and the symbolic name can be used to
load the program.
Finally, it is important to note that the program to be loaded must also use the
CHAIN command or, alternatively, use the DEFINE CHAIN directive at the
head of the program.
CHAIN filename
CHAIN "t1"
Join BASIC 10Liner Contest with ugBASIC!
An interesting competition is held at the beginning of each year: the
BASIC 10Liner Contest.
It is possible to use ugBASIC to participate in the next
"BASIC10Liner" competition, in the following categories:
CHAIN ↔ CHa
If you have found a problem with this keyword, if you think there is a bug or, more
simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!
open an issue
BACK TO KEYWORDS