stefan-b-jakobsson / basload-rom

BSD 2-Clause "Simplified" License
4 stars 0 forks source link

BASLOAD ROM version

Introduction

The purpose of BASLOAD is to make BASIC programming on the Commander X16 more convenient.

This is primarily done by using named labels instead of line numbers, and by supporting long variable names.

The BASIC source code is stored as plain text files on the SD card. BASLOAD converts the source code into a runnable program.

Source code formatting

No line numbers

Source code written for BASLOAD do not contain line numbers. Instead, named labels are decleared as targets for BASIC commands that need a line number, for instance GOTO and GOSUB.

Same BASIC commands

BASLOAD supports the standard BASIC commands of the built-in Commander X16 BASIC.

Whitespace

The following characters are recognized as whitespace:

Identifiers

General

BASIC commands, labels and variables are commonly called "identifiers" in these instructions.

All identifiers must begin with a letter, any of A to Z.

The subsequent characters may be letters (A to Z), digits (0 to 9) or decimal points.

An identifier may be at most 64 characters long.

Identifiers are not case-sensitive.

Unless two adjacent identifiers are separated by a character outside the group of characters allowed in identifier names, the identifiers must be separated by whitespace.

Example:

PRINTME  :REM A variable or label named PRINTME, will not PRINT the value of ME
PRINT ME :REM PRINTs the value of ME

Labels

Labels must be valid identifiers as set out above.

A label declaration occurs at the beginning of a line. There may, however, be whitespace before it. A label declaration ends with a colon.

You refer to a label in the source code just by typing its name without the colon.

Example:

LOOP:
    PRINT "HELLO, WORLD!"
    GOTO LOOP

A label may not be exactly the same as any BASIC command or reserved word, or exactly the same as any other previously decleared identifier.

Variables

Variables must be valid identifier name as set out above.

A variable is automatically decleared when found in the source code the first time.

As in standard BASIC, a $ after the variable name specififies it as a string, and a % specifies that it is an integer.

A variable name may not be exactly the same as any BASIC command or reserved word, or exacly the same as any other previously decleared identifier.

Example:

HELLO.WORLD.GREETING$ = "Hello, world!"
PRINT HELLO.WORLD.GREETING$

BASLOAD options

The conversion from source code to runnable program can be controlled by options stored in the source code.

An option must be at the beginning of a line, but there may be whitespace before it.

All options start with a hash sign (#) followed by the name of the option.

Some options require an argument. The option name and the argument must be separated by whitespace.

If the argument is a decimal number, you type it in as is.

If the argument is a string it may optionally be enclosed in double quotes. If so, the string may include whitespace characters.

The following options are supported:

Running BASLOAD

TODO