QUANTUM BASIC 7.1 · VERSION 1.1.0

Quantum Basic 7.1

Professional Development System v1.1.0

A QuickBASIC / PDS 7.1 compatible compiler for 64-bit Windows. Write BASIC the way you always have, and get a native x64 program out the other end. Old programs that poke video memory or call DOS interrupts keep working, and many QB64 extensions work too.

▼ Download Quantum Basic 7.1

QuantumBASIC.zip · Version 1.1.0 · Windows 64-bit

What's new in 1.1.0

What it does

How it works

Quantum Basic is a real compiler, not an interpreter. Your program goes through the same stages as a C compiler and ends up as x64 machine code, linked against the Quantum Basic runtime library.

program.bas └─ Lexer keywords, literals, type suffixes └─ Parser builds the syntax tree └─ Resolver checks names, types and scopes └─ IR lowers BASIC into a simple intermediate form └─ Codegen emits x64 assembly (NASM) └─ Link + librt.a (runtime) → program.exe

The runtime library (librt.a) is where the BASIC statements actually do their work. Two of its parts are written specially for Quantum Basic: rt_graphics_sdl2 and rt_cpu_emu.

rt_graphics_sdl2 — the graphics and sound engine

Every compiled program opens an SDL2 window, and rt_graphics_sdl2 draws everything that appears in it. It recreates the screen modes of a VGA-era PC pixel for pixel, then scales the picture to fit a modern monitor.

Screen modes and text

Drawing

QB64 images, input and window

Sound

' a one-second 440 Hz beep, made sample by sample
FOR i = 1 TO _SNDRATE
    _SNDRAW SIN(i / _SNDRATE * 440 * 6.2832) * 0.3
NEXT i
DO: LOOP WHILE _SNDRAWLEN

rt_cpu_emu — the DOS memory and CPU emulator

Many classic BASIC programs reach past BASIC and talk to the PC directly: they POKE straight into video memory, read the keyboard flags from the BIOS data area, or run small machine-code routines. On 64-bit Windows those addresses don't exist, and touching them would crash the program. rt_cpu_emu is a custom-written layer that recreates that old PC world inside your program, so the code runs as it did under DOS.

An emulated real-mode memory map

AddressWhat happens
&HA000VGA graphics memory. In SCREEN 13 each byte you POKE is a pixel, and it shows up in the window in the right palette colour. PEEK reads it back.
&HB800Colour text memory: the 80×25 grid of characters and attribute bytes. Programs that draw screens by poking text memory display correctly.
&H0000–&H9FFFConventional memory, including the interrupt table and the BIOS data area. It starts out filled in the way a real BIOS leaves it: Caps/Num/Scroll Lock state taken from your keyboard, 640K of memory, colour 80-column display.
DEF SEG = 0Addresses from VARPTR and SADD go straight to your program's own variables, so the PEEK/POKE tricks that work on BASIC data still work.
' fill the SCREEN 13 display through video memory
SCREEN 13
DEF SEG = &HA000
FOR i = 0 TO 63999: POKE i, i MOD 256: NEXT i
DEF SEG

CALL ABSOLUTE and CALL INTERRUPT

The result: programs written for real DOS hardware in the 1980s and 1990s can be compiled and run as 64-bit Windows programs, usually without changing a line.

Getting started

Download the zip and extract it to a folder. Then use the IDE or the command line.

The IDE: double-click qb71ide.exe. Write your program in the editor, then compile and run it from there. Press F1 for help on any keyword.

Important: every new program must be saved before you run it in the IDE.

The command line: open a command prompt in the folder and compile your program:

C:\QuantumBASIC> qb71 program.bas

That makes program.exe in the same folder. Run qb71 -h to see all the options.

Requirements

Quantum Basic 7.1 · v1.1.0