[img] BBC BASIC (Z80) for the ZX Spectrum
MDFS::Software.Spectrum.BBCBasic Search

Spectrum running BBC BASIC
Spectrum running BBC BASIC
This is the J.G.Harston reinterfacing of BBC BASIC (Z80) to run on the Sinclair Spectrum. I started work on this in the late 1980s, and in 2003 restarted work on it.

Install.htm   Installing BBC BASIC on the Spectrum
BBCBasic.rom  16K BBC BASIC language and system ROM.
ZXBasic.rom  16K 48K BASIC.
BBCBasic.rom  32K Combined BBC BASIC and ZX BASIC ROM.
BBCBasic.tap  17K BBC BASIC loadable to main RAM.
BBCBasic.txt  20K BBC BASIC documentation.
Utils.tap  9K Some test utilities.
Utils.mdr 135K  Microdrive file of test utilities.
Sample.tap  104K Some sample programs.
Sample.mdr 135K  Microdrive file of sample programs.
Host40.src 57K  Source for Spectrum host code.
Docs   Spectrum BBC BASIC documentation.

To run BBC BASIC you need to install the ROM in a ROM bank selected with OUT &FD. You can do this with a suitable external ROMBox, or with a Spectrum 128 or later.

Copyright and Acknowledgements

The Sinclair Spectrum version of BBC BASIC (Z80) is a conversion of the BBC Z80 Tube version of BBC BASIC (Z80). It is made available for free download on the condition that it always be distributed with the files in BBCTube.zip. BBC BASIC (Z80) and the accompanying files remain the Copyright (C) of R. T. Russell, 1982-2000. Please see http://www.rtrussell.co.uk/.

Certain code within the conversion of BBC BASIC (Z80) in order to enable it to run on the Sinclair Spectrum remains the Copyright (C) of J.G.Harston, 1989-2005.

Version history

Version 0.40
Full set of COLOUR numbers giving FLASH and BRIGHT. Ensures screen paged in before accessing screen system variables. Filing system interface substantially tidied up. Loading and saving to &FFFFxxxx selects screen memory if shadow memory present. Escaping within load/save no longer causes a crash. Drive selectable with *d:, defaults to 1: if Interface 1 found, to T: otherwise. Saving, loading and cataloging with microdrive works.

Version 0.39
Now doesn't need to be pre-configured with BASIC's ROM number. Checks ROMs to find out where BBC BASIC is on startup. Same ROM image should now work in a &7FFD ROM and in DOCK or EX. Uses a simplistic test on startup to see if Timex MMU present. Does this by checking if IN &FF is zero. Also issues Service 1 on startup to let other code have a look-in. If shadow memory paged in, ensures screen paged in when needed. BASIC runs in shadow mode with PAGE at &4000. This gives 44K free - exactly the same as with BBC HIBASIC on the 6502 CoProcessor!

Update: ensured file load/save deselects the screen where appropriate. Note: with PAGE at &4000 can't load files into screen memory at the moment. Need to fully implement 32bit->16bit addressing as specified in Spectrum/FileDocs. Also, Escaping from cat/load/save with shadow memory present causes a crash. BBC BASIC uses DOCK/EX as previously selected, doesn't ensure same is selected, so slight chance DOCK may swap with EX.

First version made that can run from main RAM. Results in PAGE at &6000 and HIMEM at &BB00. Seems to work, but not fully tested yet.

Version 0.38
ROM port no longer a variable. ROM paging able to use Timex/Spectrum SE paging registers at &F4 and &FF. ROM numbers are:

DOCK/EX paging disabled by default with b7 of SCREEN set. Will also select external ROMs with OUT &7FFD,n*16 with n>3. Shadow memory can page screen out if available by ORing ROM number with 3. BASIC ORs its own ROM number with 3 to try to select shadow memory.

Testing reveals v0.38 works on the Spectrum SE, but when BASIC pages the screen memory out it forgets to page it back in to check for keypresses! Filenames now changed slightly, adding '.rom' extensions for easier use on extension insistant systems.

Version 0.37
Generalised ROM paging routine, ROM port a variable in high memory. IM2 interupts use I=&FD with two overlapping vectors at &FDFE-&FDFF and &FDFF-&FE00 so interupts with data=&FE and data=&FF both work. RdCh checks for Escape state before waiting for a key, so Escape state doesn't wait for a keypress.

Version 0.36
Page &FFxx entry points rearranged to fit ROMPAGE entry point in. High memory contains ROM numbers of BBC BASIC and ZX BASIC, so can be changed. Reset code rewritten, doesn't clear memory, abandoned seperating RST &00 from RESET. *Quit quits Speculator with &FDFD opcode. MEMBOT a variable and so can be changed.

Best viewed with Any Browser Valid HTML 4.0! Authored by J.G.Harston - Last update: 10-Jul-2006