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
30

Where You Go From Here

Introduction

You have written a game: two hundred lines, four rooms, a parser, two puzzles and a clock, all of it BBC BASIC you typed yourself. This last section looks at how much further it could go, and where you might go next.

How Big Is It?

LOAD "GAME"
PRINT TOP-PAGE
PRINT HIMEM-TOP

TOP-PAGE is the length of the program in memory, and HIMEM-TOP the room left above it for variables and more program.

The Code

The three lines above, at the >.

Starting from

The course disc.

What you should see

>LOAD "GAME"
>PRINT TOP-PAGE
      5214
>PRINT HIMEM-TOP
     38818

DRIFT is about five thousand bytes. There is room for seven more of it.

Growing DRIFT

Everything about the ship is in DATA, and the program is built so that most of it would not notice a bigger ship:

  • More rooms. The map is four DATA lines and DIMs of 4. Make the arrays bigger, add rooms and exits, and change the 4s in the loops that go through the rooms - or better, keep the number of rooms in a variable, as NV% does for the words.
  • More things, more words. The objects and the word table are the same: a DATA line each, and a bigger DIM.
  • More puzzles. A new flag and a new procedure, like LOCK% and PROCOPEN.
  • Saving the game. ANIMAL showed how: OPENOUT, PRINT# for R%, AIR%, the flags and every object's L%(), then CLOSE#; and to load, OPENIN and INPUT# in the same order. Read numbers back into number variables - a number written with PRINT# is not stored as text.

Beyond BASIC

BBC BASIC on the Einstein has a whole Z80 assembler built in: the manual, BBCBASIC(Z80) by Doug Mounter, has a chapter on it, and on files, errors and everything else this course left out. It is on the Downloads page, with the BBC BASIC disc.

And there are other courses here, on the same machine:

  • Z80 Assembly - the Einstein at its own level: the processor, the screen, the keyboard grid and the sound chip, directly.
  • Xtal BASIC - the BASIC that came on the System Master, which builds a platform game with sprites.
  • Dr Logo, SuperForth and C - three quite different ways to program the same Einstein.

Change One Thing

  • LOAD "ANIMAL" and PRINT TOP-PAGE. Which program is bigger?
  • LOAD "GAME", then LIST 1000,1090. Could you add a fifth room now, knowing what you know?

Exercises

30.1 Add a fifth room to DRIFT - an airlock east of engineering, say - with its own description.

Worked solutions are in Appendix II.

Summary

DRIFT is about 5K of a machine with nearly 44K free for BASIC. Its data-driven design means it can grow by adding DATA. The manual covers the rest of the language, including its built-in assembler, and the other courses cover the rest of the machine.

Next

That is the end of the course. Appendix III lists what is on the disc, including the whole of DRIFT; Appendix IV is the keyboard.

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.