Skip to content

D/BASIC LANGUAGE REFERENCE · 2026-09-03

Write like it is 1988. Ship like it isn't.

D/BASIC keeps the directness that made BASIC inviting—readable code, numbered lines when you want them, and useful programs before lunch—then adds structured procedures, records, objects, widgets, semantic operating-system calls, and one optimized bytecode artifact that can travel.

D/BASIC is QuickBASIC-compatible at its familiar language core, but it is its own modern language: designed for portable applications, D/OS, and the machines people use now.

Open the playgroundCompile and run D/BASIC in the browser. Follow the tutorialsStart small, then build windows, widgets, and games. Use the quick referenceFind syntax, types, statements, events, and Intents.

Alpha

D/BASIC is in alpha, so some features in this complete language reference may not yet be available in every current compiler, runner, or target.

Easy on purpose

BASIC was created to let ordinary people tell a computer what to do. Its great trick was not being simplistic; it was making the important things visible. PRINT prints. IF makes a choice. FOR repeats. A small program reads from top to bottom like a set of instructions you might give another person.

D/BASIC keeps that friendliness. It is rooted in the home-computer and compiled-BASIC tradition, where curiosity and a blinking cursor were enough to begin. You can type one line and see a result, use the compact %, &, !, #, $, and @ suffixes old-school programmers love, or write explicit modern declarations when clarity matters more than nostalgia.

It is retro-rooted, not retro-limited. The same language grows into named procedures, multidimensional arrays, value records, classes, inheritance, virtual dispatch, deterministic object lifetime, reusable widgets, packaged media, networking, semantic data services, and full window applications. The D/BASIC toolchain turns the source into validated, optimized DBC bytecode instead of tying it to the machine on which it was written.

That combination is the pitch: a first language that does not become a dead end, and a systems language that does not demand ceremony before the first success. A learner can make a number-guessing game; the same ideas scale to a document editor with menus, forms, data sessions, and portable graphics.

A short trip from the teletype to D/OS

BASIC began at Dartmouth in 1964 with John Kemeny and Thomas Kurtz and a radical goal: computing should not belong only to specialists. The name—Beginner's All-purpose Symbolic Instruction Code—said the quiet part out loud. A student could sit at a terminal, type understandable instructions, and get an answer.

In the late 1970s and 1980s, BASIC became the welcome mat of the personal computer. Turn on an Apple, Commodore, Atari, TRS-80, or countless other machines and there it was: a prompt, ready before an application had loaded. Those dialects taught a generation that software was something you could make yourself. They also tied clever programs to memory addresses, video chips, and wonderfully peculiar hardware.

Compiled BASIC systems brought that immediacy into a structured world: named procedures, local variables, user-defined types, and editors that made larger programs reasonable. Event-driven BASIC later showed how approachable syntax could build graphical applications and object-shaped systems.

D/BASIC picks up that thread rather than embalming it. It keeps numbered lines, familiar suffixes, PRINT, GOSUB, and the expression rules transferred programs depend on, while adding the parts a modern portable application needs: classes, widgets, semantic Intents, deterministic lifetime, an optimizing compiler, and validated bytecode. The retro roots remain visible; the machine-specific cage does not.

The idea in one screen

10 PRINT "HELLO FROM THE SAME OLD FUTURE"

DIM Names$(1 TO 3)
ARRAYFILL Names$(), "READY"

FOR I% = LBOUND(Names$) TO UBOUND(Names$)
  PRINT I%; Names$(I%)
NEXT I%

That is recognizably BASIC. The unusual part happens after the source leaves your editor:

.bas source → parse + type → optimize + lower → validate → .dbc bytecode → D/OS · browser · Windows · Linux · macOS

There is one language and one bytecode contract. A target chooses how to provide graphics, sound, data, and other capabilities; it does not get to invent a private dialect.

Why D/BASIC exists

BASIC should still feel immediate

The first useful D/BASIC program is still one line. Line numbers remain legal. GOTO remains spelled GOTO. You can bring old habits with you, then adopt named labels, procedures, records, and classes when the program earns them.

Portability should be architectural, not hopeful

Classic programs often hid a machine model inside PEEK, POKE, magic addresses, and vendor graphics commands. D/BASIC replaces those exits with Intents and Services: named requests such as “fill this rectangle,” “present this frame,” or “set my window title.” The host may implement a request with a GPU, a compositor, a coprocessor, or a tiny device route. The program keeps the same meaning.

Storage follows the same honest boundary. FILE manipulates bytes at a named mount and path; DATA is D/BASIC's database equivalent, working with identities, queries, revisions, and durable receipts. Neither one smuggles a host path or native handle into portable code.

Small computers deserve modern structure

TYPE gives compact value records. CLASS adds identity, encapsulation, inheritance, virtual methods, deterministic lifetime, and weak links. The D/Works widget library is itself D/BASIC, proving that the object model is for building real programs rather than decorating toy examples.

The first 6502 target profile is designed around a 512 KiB logical program workspace. Banking and paging stay behind the runner, while semantic Intents let the system accelerate graphics, math, bulk work, and services without putting machine-specific APIs in the program.

Optimization should preserve meaning

The compiler can intern constants, batch safe floating-point expression trees, turn whole-array work into single semantic instructions, and bind shared libraries by exact identity. These are not target dialects. The optimized DBC still describes one program, and a conforming runtime can choose the best local execution route without changing its result.

Failure should tell the truth

When a program asks for a capability the host does not offer, D/BASIC refuses by name. It does not fake success, silently pick a different file, or let unsupported machine access corrupt state. Refusal is a portable, diagnosable outcome—and learning to read one is part of learning the language.

Learn it in human order

This reference is arranged as a course you can dip into, not an alphabetized wall of keywords.

Foundations

Applications and the outside world

Reuse, migration, and delivery

The five ideas worth remembering

  1. Line numbers are welcome, not required. Named labels and structured blocks live in the same source.
  2. Untyped numeric names are SINGLE. Use a suffix, AS, or DEFINT A-Z when you mean an integer.
  3. Parameters are BYREF by default. Write BYVAL when the callee should receive a value it cannot use to rebind the caller.
  4. TYPE copies; CLASS shares identity. This one distinction explains most record and object behavior.
  5. Programs express intent, hosts provide capability. That is how one program crosses very different machines.

New today: whole-array work

ARRAYFILL and ARRAYSWAP join ARRAYCOPY as first-class whole-array verbs. Fill changes every value. Swap changes who owns the array—its contents, bounds, and rank move together without moving the elements.

DIM Front%(1 TO 1000), Back%(1 TO 1000)

ARRAYFILL Back%(), 0
' ...prepare Back()...
ARRAYSWAP Front%(), Back%()

See Arrays for the exact rules and the difference between copying, filling, and swapping.


Ready? Run your first program →