
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.
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 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.
Everything about the ship is in DATA, and the program is built so that most of it would not notice a bigger ship:
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.DATA line each, and a bigger DIM.LOCK% and PROCOPEN.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.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:
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?30.1 Add a fifth room to DRIFT - an airlock east of engineering, say - with its own description.
Worked solutions are in Appendix II.
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.
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.