A Tiny BASIC cross-compiler for the Commodore-64
This program will compile Tiny BASIC source code to Commodore-64 assembly in DASM format.
This project is still in beta. Please report any bugs that you may have found and I'll fix them as soon as possible.
- Pick a pre-built executable from the
bin/dir and copy it to the project dir or typedub buildto compile from source (install dub first). - In the project dir type
./tinybasic64 source.bas > target.asmto compile basic source code to assembly source.
- 16-bit signed integers only
- only one statement per line
- no string type variables (string constants are supported)
- no arrays
There are a few differences to the original gramamar definition (read Tiny BASIC on Wikipedia):
- Keywords are in lowercase.
- Line numbers are optional. You can use labels, line numbers or both. The following example will compile:
10 rem this line is numbered
20 gosub my_sub
print "this is just a line"
end
my_sub:
print "this will be printed first"
return
- Variable names are case-sensitive and they can consist of any letters, numbers or underscores of any length. (they must not start with a number though).
gosub <expression>andgoto <expression>are not supported. You can only use labels or line numbers.poke n,mandpeek(n)are supported