BBC BASIC 2.31 for the Tatung Einstein, showing DRIFT, the text adventure the course builds, in the middle of a game
← Back to Courses
module
2

Setting Up

Introduction

This is the only section with no BASIC in it to speak of. By the end of it you will have an Einstein running on your own machine, with BBC BASIC loaded and waiting for you, and somewhere to keep the programs you write.

Set it up once and it stays out of your way.

If You Have A Real Einstein

Most of this section is about the emulator, and you can pass over it. What you need instead is your BBC BASIC disc, which has BBC BASIC on it as BBCBASIC.COM. Work on a copy of it, not the original: this course saves work to disc from S6 onwards, and a slip at the keyboard can overwrite something.

Start the machine with the disc in the drive, and when you have the 0: prompt, pick this section up again at the point where it types BBCBASIC.

Three things are different for you from here on.

  • Lines beginning "In MAME" are not for you. They say where a key is on a modern keyboard. Yours has the Einstein's names on it.
  • "Restart the Einstein" means switch it off and on again, and boot your disc.
  • The course disc carries DRIFT, the finished game this course builds. Your disc does not, and you will not need it.

What You Are Installing

Three pieces, all free.

PieceWhat it does
MAMEThe emulator. Given the right ROM, it behaves like an Einstein.
The Einstein ROMThe machine's own built-in software. MAME cannot be an Einstein without it.
The BBC BASIC course discA disc image with BBC BASIC 2.31 on it, the 1984 animal-guessing game, the finished DRIFT, and 160K of room for your own work.

The disc matters more than it looks. BBC BASIC keeps your programs on its disc, so it has to be able to write to it, and MAME will not write to a .dsk disc image. It will write to an .mfi. The ordinary .dsk images you will find elsewhere boot perfectly and then fail the first time you try to save anything. The course disc is an .mfi for that reason.

Installing

These steps cover macOS and Windows. Everything in this course was written and checked on macOS; the Windows steps are written from MAME's own documentation rather than from our own machine, so if something here is wrong or missing, please tell us and we will fix it.

Linux is not written out separately - MAME is in every major distribution's package manager, and from step 2 onwards the Linux instructions are the macOS ones.

1. MAME

On macOS, the easiest way is Homebrew. If you do not already have it, follow the instructions at brew.sh, then:

brew install mame

Check it is there:

mame -version

On Windows, MAME is a download from mamedev.org/release.html. Take the 64-bit binary - mame0289b_x64.exe, or mame0289b_arm64.exe if your PC has an Arm processor. It is a self-extracting archive rather than an installer: run it, choose a folder such as C:\mame, and it unpacks a pile of files including mame.exe.

There is no installer and nothing is added to your Start menu. You work in the folder you unpacked into.

The course is written against MAME 0.289. A later version will almost certainly be fine; if something behaves differently from what a section describes, the version is the first thing to check.

2. The Einstein ROM

It is a file called einstein.zip. Download it from Einstein System ROM (MOS 1.2 & 1.21) on the Downloads page. It goes in a folder called roms.

On macOS, make one in your home folder:

~/roms/einstein.zip

On Windows, MAME already unpacked a roms folder next to mame.exe. Put it there:

C:\mame\roms\einstein.zip

Do not unzip it. MAME wants the .zip exactly as it is.

3. The Disc

Download the BBC BASIC course disc and put it somewhere you can find again.

On macOS, a folder called einstein in your home folder will do:

~/einstein/bbcbasiccourse.mfi

On Windows, next to MAME is simplest:

C:\mame\bbcbasiccourse.mfi

Keep a spare copy of it somewhere. Your work is going onto this disc, so a mistake at the keyboard can overwrite something, and a second copy of the file you downloaded costs nothing.

Starting The Machine

One command, and it is the same one every time.

On macOS, in Terminal:

mame -rompath ~/roms einstein -flop1 ~/einstein/bbcbasiccourse.mfi -window

On Windows, open a Command Prompt in the folder you unpacked MAME into and type:

mame.exe -rompath roms einstein -flop1 bbcbasiccourse.mfi -window

The quickest way to a Command Prompt in the right place is to open the folder in File Explorer, click in the address bar, type cmd and press Enter.

Either way the parts mean the same thing: -rompath says where einstein.zip is, einstein is the machine to be, -flop1 is its first disc drive, and -window keeps it in a window rather than taking over the screen. Keep the -window - without it MAME takes the whole screen, which on a Mac means a new desktop space as well.

It is worth saving that line somewhere - a shell alias on macOS, or a .bat file on Windows - because you are going to run it a lot.

A window opens and the Einstein boots from the disc:

           ***  EINSTEIN  ***

TATUNG/XtalDOS 1.11        (C) 1983 1984

0:

That 0: is the disc operating system waiting for a command. BBC BASIC is a program on the disc, and you ask for it by name. Type:

BBCBASIC

and press ENTER. A few seconds later BBC BASIC announces itself on the lines below:

0:BBCBASIC
Einstein BBCBASIC Version 2.31
(C) Copyright R.T.Russell 1984
>

The > is BBC BASIC waiting for you, and you will see it a great deal. It is its whole way of saying "ready".

Check the number. The course disc will always say 2.31. If a disc of your own says something else, S1 explains what that means.

Whose Keyboard It Is Now

While the MAME window is in front, your keyboard is the Einstein's. MAME lays the Einstein's keys over yours by position, so a few characters are not where your own keys say they are. S3 deals with that. The only one you need in this section is the double quote: " is SHIFT and 2, whatever is printed on your own 2.

The machine starts with CAPS LOCK on, so everything you type comes out in capitals. Leave it that way. S3 says why it matters.

MAME has control keys of its own as well - Esc to quit, F3 to reset - and it starts with them switched off, so that those keys reach the Einstein, which needs them: the Einstein has an ESC key, and you will use it. One key switches MAME's own keys on: forward delete on a Mac (Fn and Backspace on a laptop), and Scroll Lock on Windows according to MAME's documentation. Leave it alone. If Esc ever closes MAME instead of reaching the Einstein, that key has been pressed, and pressing it again puts things back.

To stop the Einstein, close the MAME window. Where the course says restart the Einstein, that means close the window and run the command again.

The Code

PRINT "BBC BASIC IS RUNNING"

PRINT, a space, and the message in double quotes. Then ENTER.

Starting from

A fresh boot, with BBC BASIC just started.

What you should see

The line you typed, the message on the line below it, and the > again:

>PRINT "BBC BASIC IS RUNNING"
BBC BASIC IS RUNNING
>

The check line typed at BBC BASIC, with its output on the line below

If you get that, everything is installed and working. S3 explains what just happened, and what BBC BASIC says when it does not understand you.

Change One Thing

  • Run the command with the ROM path spelled wrong - -rompath ~/romz on macOS, -rompath romz on Windows. MAME refuses before the machine even starts. Read what it says. Seeing that message once, deliberately, saves you ten minutes the day you see it by accident.
  • Run it with the whole -flop1 part left off, so the machine starts with no disc in it at all. You get a different screen with an instruction on it, and a > without a sign-on above it. Try typing BBCBASIC anyway - what does it answer, and why could it never have worked?

Stopping A Program

Sooner or later you will write a program that runs for ever. ESC stops it. The program halts, BBC BASIC says where it had got to - Escape at line 20, say - and the > comes back, with your program still in memory.

In MAME: ESC is the Esc key.

When It Goes Wrong

SymptomCause
MAME says mos12.i023 NOT FOUND and Required files are missingThe ROM is not where it is looking. Check that einstein.zip is in the roms folder and that -rompath points at that folder.
On Windows, mame.exe is not recognisedYou are not in the folder you unpacked MAME into. cd to it first, or type its full path.
MAME takes over the whole screenYou left out -window. MAME's own default is full screen.
You get Insert disc in drive 0 and press Ctrl-BREAK to load, Ready and a >The machine started without a disc. Check the path after -flop1; MAME will have complained about it in the terminal you started it from.
You type BBCBASIC and get Error!Same thing. That > is the machine's built-in monitor, not the disc operating system, and it has no disc to load BBC BASIC from.
The key marked " on your keyboard gives some other characterYour keyboard's legends do not apply; the Einstein's do. " is SHIFT and 2.
Esc closes MAME, or F3 restarts the EinsteinMAME's own control keys have been switched on. Forward delete on a Mac (Fn and Backspace on a laptop), or Scroll Lock on Windows, switches them off again.
Bad Data, Drive 0: and Try Again(Y/N)? the first time you saveYou are running from a .dsk image, and MAME will not write to one. Answering N drops you out of BBC BASIC to 0: - but your program is not lost: type BBCBASIC, then OLD, and it is back. Then restart the Einstein with the course disc, which is an .mfi, and save there.

Summary

MAME plus the Einstein ROM gives you the machine; the disc gives you BBC BASIC and somewhere to keep your work. One command starts it, BBCBASIC loads the language, and > with a cursor after it means it is waiting for you. ESC stops a program that will not stop.

Next

S3, Talking To BBC BASIC - what > is waiting for, what happens to a line when you press ENTER, what BBC BASIC says when it does not understand, and how to leave.

Get the Newsletter

New guides, disk images and community finds, roughly once a quarter. No spam, we promise, this isn't Tatung's marketing department.
Your subscription could not be saved. Please try again.
Your subscription has been successful.

Newsletter

Subscribe to our newsletter and stay updated.