BBC BASIC for the NDR Klein Computer
- Assembly 94.5%
- Python 2.1%
- Makefile 1.9%
- Shell 1.5%
The BASIC data-RAM base (RAMBASE, default $6000) and the IO-USB card I/O port (SPIPORT, default $30) are now set at build time via the Makefile (-DRAMBASE/-DSPIPORT), so a board whose RAM sits elsewhere builds with e.g. `make RAMBASE=0x8000`. The boot loader sizes RAM from RAMBASE rather than from the $2000 code area, so it starts even when the code window ($2000-$5FFF) and the data RAM are separate regions (no RAM at $6000-$7FFF). On a contiguous board the probe returns the same top, so behaviour is unchanged there. config.inc derives MINRAMTOP and the boot size readout from RAMBASE; vdip.asm takes the SPI port from SPIPORT. Both keep their old defaults via IFNDEF, so the standard images are byte-identical in layout. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .forgejo/workflows | ||
| .githooks | ||
| docs/img | ||
| examples | ||
| src | ||
| tools | ||
| .gitignore | ||
| CHANGELOG.md | ||
| CLAUDE.md | ||
| FLO3.md | ||
| INSTALLATION.md | ||
| LICENSE | ||
| Makefile | ||
| MANUAL.en.md | ||
| MANUAL.md | ||
| README.en.md | ||
| README.md | ||
| SERIAL.md | ||
NKC BBC BASIC (Z80)
Deutsche Fassung: README.md.
A port of R. T. Russell's BBC BASIC (Z80) 3.00 to the NDR-Klein-Computer:
it runs on the GDP64 (EF9366) graphics card, the parallel ASCII keyboard, and a
pluggable file system for storage — an IO-USB stick or a serial Kermit
server (depending on which boot ROM is burned).
BASIC runs entirely in RAM and is loaded from the backend at startup. Runs on
real hardware and on the SDL2 nkcemu emulator.
See MANUAL.en.md for the full user guide.
What it does
- Integer + floating point, full strings — the complete BBC BASIC language.
- Graphics on the GDP64:
MOVE/DRAW/PLOTwith software fills (filled triangle/rectangle, points),GCOL,MODE,CLS/CLG. - EF9366 attributes via
VDU 23(line style, text orientation, char size) and*aliases;VDU 5text on the graphics plane; filled blocks. - Filing:
SAVE/LOAD,*SPOOL/*EXEC(text), and full data files (OPENIN/OPENOUT/OPENUP,BGET#/BPUT#/PTR#/EXT#/EOF#/CLOSE#) on the IO-USB and Kermit backends. *commands (*DIR,*ERA,*RENA,*RESET, …) via an extensible table.- Copy-cursor line editing (arrows + COPY), clear-line (Ctrl-U / ESC),
real
TIME, and autostart (autostart.execon the stick). - RAM auto-sizing at startup: uses exactly the RAM that's fitted (from
$4000up), 48K downward —HIMEMis set automatically.
Layout
Sources live in src/, build artifacts in build/.
| File | Role |
|---|---|
src/mos.asm |
Machine-OS layer: the 21 BBC BASIC host entry points, the VDU/OSWRCH console + the OSLINE editor, OSCLI/* commands, filing shims. |
src/nkcdev.asm |
GDP64/EF9366 graphics + parallel-keyboard drivers (transcribed from the Grundprogramm 3.1 MCP31.ASM). |
src/vdip.asm |
IO-USB driver (VDIP1/VNC1L SPI): whole-file LOAD/SAVE + channel-based data files. |
src/kermit.asm |
Kermit driver (serial backend over COM1): LOAD/SAVE, *EXEC/*SPOOL, file channels and *DIR/*ERA/*RENA over Kermit REMOTE commands. |
src/diskjt.asm |
Disk jump table: fixed-address slots through which BASIC, the loader and the monitor reach the selected backend — so one BASIC.BIN runs on every boot ROM. |
src/hwgdp.asm |
GDP-native graphics/screen layer (replaces the distribution's TMS9918 hardware.asm): MOVE/DRAW/PLOT/fills, EF9366 attributes, VDU 5 text. |
src/serial.asm |
SER2 driver (88C681 DUART): interrupt-buffered COM1:/COM2: channels. See SERIAL.md. |
src/boot.asm |
Stage-0 EPROM at $0000: paints the banner, verifies the BASIC at $2000 by its embedded checksum (in ROM, or kept in RAM across a reset), loads BASIC.BIN from the backend only when that fails, then jumps in. |
src/config.inc |
Single source of truth for the memory map. |
src/bbcbasic/ |
The vendored BBC BASIC core (main/exec/eval/fpp/ram.asm) from https://github.com/jblang/bbcbasic-z80 (zlib). cpm.asm and hardware.asm are unused — replaced by mos.asm/nkcdev.asm/hwgdp.asm. |
examples/ |
Sample programs (EF9366.TXT exercises every graphics feature; SER2.TXT/SERCHAT.TXT for the serial card). |
Build
make # -> build/BASIC.BIN, boot_{usb,kermit}.rom (burn one),
# basic_{2000,4000}.rom (ROM variant)
make clean
Toolchain: z88dk-z80asm.
Run (emulator)
The SDL2 nkcemu emulator lives in the sibling directory ../nkcemu:
cd ../nkcemu && cmake -B build && cmake --build build
# the stick can be a merge of several directories (repeat -u), e.g. the build
# output + the examples -- no copying or symlinks:
./build/nkcemu -b ../nkc-bbc-basic/build/boot_usb.rom \
-u ../nkc-bbc-basic/build -u ../nkc-bbc-basic/examples
Licence / provenance
- This port — the MOS/host layer, the serial driver, the GDP-native
graphics layer, the boot loader, the examples, build and docs — is under the
MIT licence: see
LICENSE. - The vendored BBC BASIC (Z80) interpreter core in
src/bbcbasic/is © R. T. Russell / J. B. Langston, under the zlib licence: seesrc/bbcbasic/LICENSE. - The GDP/keyboard/VDIP drivers (
nkcdev.asm, parts ofvdip.asm) are transcribed from the Grundprogramm 3.1 source (MCP31.ASM).