AntBASIC
AntBASIC is the Ant64's built-in programming language — the one waiting at the Ready. prompt when the machine starts. If you have never written a line of code, this is a friendly place to begin. If you grew up on a 1980s home computer, it will feel like coming home — only faster.
This page is the gentle tour. The full, precise details are in the Language Specification.
What is BASIC?
BASIC is a language built to be learned by doing: you write a short program, run it, and see the result at once — no project to set up, no compiler to invoke. That immediacy is the point, and AntBASIC keeps it.
A program is a list of numbered lines. Type this at the Ready. prompt:
10 PRINT "Hello, Ant64!"
then type RUN, and the machine answers:
Hello, Ant64!
That is a complete program — you wrote a line, RUN set it going, and it worked. LIST shows your program back to you; RUN runs it again. Nothing to install, compile or configure.
A first program
Bigger programs are just lists of instructions, each on a numbered line so the computer knows the order to follow:
10 PRINT "What is your name?"
20 INPUT name$
30 PRINT "Hello, "; name$; "!"
40 FOR i = 1 TO 3
50 PRINT "Nice to meet you."
60 NEXT
Type RUN and it asks your name, greets you, and says it is nice to meet you three times. You can already read most of it: PRINT shows text, INPUT asks for some, FOR … NEXT repeats. That is the shape of nearly every program you will ever write — show something, ask something, repeat something, decide something.
Deciding and repeating
Add one more idea and you can build almost anything:
10 FOR n = 1 TO 10
20 IF n MOD 2 = 0 THEN PRINT n; " is even" ELSE PRINT n; " is odd"
30 NEXT
IF … THEN … ELSE chooses; FOR … NEXT repeats. Between PRINT and INPUT, a way to remember values (variables, like name$ and n above), and a way to decide and repeat, you have the toolkit that classic BASIC gave a whole generation.
What makes AntBASIC modern
AntBASIC keeps the friendly surface but sheds the frustrations older BASICs were famous for. As you grow, you will find:
- It's fast. The Ant64 is a modern machine, so AntBASIC runs quicker than the hand-written assembly of the 1980s micros — you rarely have to leave BASIC to make something feel instant.
- Proper building blocks. Name a chunk of work as a
PROCor aFNand call it by name, instead of leaping around withGOTO. Programs stay tidy as they grow. - Real data. Beyond single values there are lists, dictionaries, stacks, queues and named records — the containers you actually reach for, built in.
- Split it across files. When a program gets big,
includeanother file as a named module and use its pieces with a dot —maths.FNsin(x)— so you build something once and reuse it everywhere. - It talks to the hardware. From BASIC you can reach the Ant64's graphics, sound and input — and, when you want to, drop to assembly for either processor right inside your listing.
- Nothing is lost.
SAVEyour work as readable text, or ship it as a self-contained.baxexecutable.
None of that is in your way on day one. You can spend a happy afternoon with just PRINT, INPUT, IF and FOR, and reach for the rest when you are ready.
Coming from another language
If AntBASIC is your first language, skip ahead — this part is for people who already program.
…from a classic home-computer BASIC
If you cut your teeth on a ZX Spectrum, Commodore 64, BBC Micro or an MSX, most of this is muscle memory. Line numbers, PRINT / INPUT / FOR … NEXT / IF … THEN, RUN / LIST / SAVE all work as you remember, and ? is still shorthand for PRINT. What has changed is the frustrations:
- You rarely need
GOTO. Name a routine as aPROCorFN, give it parameters, call it by name — the listings that used to turn to spaghetti stay readable.REPEAT,WHILEandCASEare here too. - Strings aren't tiny. No 255-character ceiling, and no fixed string-space to run out of.
- The structures you used to fake with arrays are built in — lists, dictionaries, stacks, queues and named records.
- It's genuinely fast — fast enough that you seldom drop to assembly for speed, though you still can, for two different processors, right in your listing.
- Big programs split up.
includea second file as a named module instead of keeping one giant listing.
One thing is genuinely different: there is no automatic immediate mode. The Ready. prompt is the Ant64's command line, so a bare PRINT "hi" looks for a command called print, not the BASIC statement — you build your program in numbered lines and RUN it. When you do want to run a statement on the spot — to peek at a variable after a run, say — prefix it with a colon: :PRINT total runs it in your program's live context. (And the commands — RUN, LIST, SAVE — are themselves just scripts, which is why you can add your own.)
Think of it as the BASIC you knew, with the sharp edges filed off and a modern engine underneath.
…from a modern language
If you know Python, JavaScript or similar, every idea will be familiar — variables, loops, conditionals, functions, lists and dictionaries, strings — just wearing retro clothes:
| In Python-ish terms | In AntBASIC |
|---|---|
print("hi") |
PRINT "hi" |
name = input() |
INPUT name$ |
for i in range(10): |
FOR i = 0 TO 9 … NEXT |
def greet(n): |
DEF PROCgreet(n$) |
a list / a dict |
a LIST / a DICT |
import x as m |
m = include "x.bas" |
A few things to expect:
- Lines are numbered, and the prompt is a command line, not a REPL. You don't type
2 + 2and see4; you build a numbered program andRUNit. (For a REPL-style poke at a running program, a leading colon does it —:PRINT totalruns that statement in the live context.) The prompt is AntOS's command line — it runs named scripts by default (;runs inline Luau), soRUNandLISTare commands, not language built-ins. - Types are marked by a symbol on the name:
count%is an integer,totala floating-point number,name$a string. It looks odd for a day, then vanishes. - Statements are words, not punctuation —
PRINT,FOR … NEXT— and blocks close by name (ENDIF,NEXT,ENDWHILE) rather than by indentation. - It is interpreted, but not slow — and there is no garbage-collector pause to trip over, which matters the moment you write a game.
You are not giving up the modern conveniences; they are just spelled the way a home computer would have spelled them.
Where to go next
- AntBASIC Language Specification — the complete reference: every statement, the type system, structures and collections, error handling, modules, the storage formats, and how the engine works underneath.
- Inline assembler — ARM64 and RISC-V — dropping to machine code from BASIC, for the last drop of speed or to touch the FPGA directly.
- The
basiclibrary and its script API — how BASIC is built as an AntOS service, for when you want to write tools around it.
Welcome aboard. Type PRINT "hello" and see what happens.