About

What is STELLAR?

“System for Time-shared Execution on Low-Level Architecture Resources”

STELLAR-1802 is a multitasking language layer for the RCA COSMAC 1802, a microprocessor from 1976. It sits between the bare chip and the programs you write: instead of 1802 machine code, a STELLAR program is a list of STELLAR commands, and STELLAR's firmware carries them out. Up to four programs run at once, each in its own virtual machine (VM) with its own registers, memory and position in its code, while one 1802 shares its time among them.

The 1802 is a spare, unusual chip. It is 8-bit, with sixteen 16-bit registers but no stack instructions, no call or return instruction, no multiply and no divide. STELLAR fills those gaps for its programs: they get calls and returns, stacks, 16- and 32-bit arithmetic with multiply and divide, decimal printing, strings, a terminal, the front panel and the clock, as about two hundred ready-made commands.

1How it works

A program is bytecode. Each STELLAR command is one byte saying what to do, often followed by a byte or two saying what with: 11 05 00 0A loads 10 into register R5, C1 0F prints the string register RF points at. The full set is in the opcode reference.

The firmware is an interpreter. It fetches a VM's next command, looks it up in a dispatch table, and runs the 1802 routine that carries it out. One command costs the chip roughly 190 of its own instructions: fetching and dispatching, the scheduler's bookkeeping, the calls between routines, and the work itself.

Each VM is a block of memory. Everything a VM knows (sixteen 16-bit registers, its accumulators, its flags, its place in its code) lives in a 256-byte core. Its program lives in its own 4 KB program block. Switching from one VM to another is just pointing the firmware at a different core. The VM Core page shows one core live.

The scheduler takes turns. Each running VM gets a short turn of a few commands (its quantum), then the scheduler hands the chip to the next. A VM waiting for a key gives up its turn at once instead of stalling the others. A shared page of memory, the CIDP, holds each VM's state and lets the VMs see and signal each other. Watch it happen on the Multitasking page.

A way out to the bare chip. When a program needs raw speed, one command (RUNMC) runs a piece of 1802 machine code directly and comes back, about a hundred times faster than the same work in commands, at the cost of holding the chip while it runs.

The Architecture page has the detail: the memory map, the jobs the 1802's own registers are given, RCA's call-and-return technique, and the CIDP.

2What it runs on

STELLAR runs on a COSMAC Elf 2000 (the “Elf2K”), Spare Time Gizmos' modern build of the classic 1970s COSMAC Elf hobby computer:

CPU
an RCA CDP1802 microprocessor.
Memory
32 KB of battery-backed RAM ($0000–$7FFF), which holds STELLAR and its programs; 32 KB of EPROM above it with the Elf2K's own monitor and BIOS.
Front panel
eight toggle switches, a two-digit hex display, the INPUT, LOAD and RUN switches, and the Q light. STELLAR programs can read the switches and INPUT, and drive the display and Q.
Disk/UART/RTC card
a serial port (a 16C450 UART) for the terminal every STELLAR program talks through, and a DS12887 real-time clock that STELLAR can read and set.
Terminal
any serial terminal or terminal program, VT100-style for the full-screen programs.

STELLAR itself fills about 12 KB at the bottom of RAM. Above it sit the shared CIDP page, the four VM cores, and the four 4 KB program blocks at $4000, $5000, $6000 and $7000. Firmware and programs are loaded the same way, as lines of hex bytes (D-lines) that the Elf2K's monitor types into memory.

You don't need an Elf2K to try it: every page on this site runs STELLAR's real firmware on an emulated 1802 in your browser. Start with the Simulator.

3How STELLAR programs are written

STELLAR's firmware was written straight in hex, with no assembler: every 1802 instruction worked out by hand, typed as bytes, and tested on a real Elf2K. Most STELLAR programs on this site were written the same way, command by command. Programs can also be written in Stellar C, a small C-like language that compiles to STELLAR commands, with a step-by-step guide.

4History

Why STELLAR was created, and how it came to be, will be told here.

See it run

The home page runs four STELLAR programs at once, with the chip's memory lit up beside them.