BBC BASIC V
A dabhand guide

BASICV a Dabhand Guide Part 1

© APDL and Alligata Media

This book was originally published by Dabs Press in 1992 and is reproduced here with their permission. This HTML version is Copyright © APDL and Alligata Media 2006. All rights reserved. No part of this publication may be reproduced or transmitted in any form or by any means without the prior written consent of the Publisher nor circulated in any form, binding or cover other than that in which it is published and without a similar condition being imposed on the subsequent purchaser.

About this book

We have largely left this book unaltered: the original edition was written by Mike Williams and included a section relating to the DABS Press books and software which has, of course, been deleted and we refer you to www.apdl.co.uk for extensive details of our software, hardware and book range.


Contents

Introduction

Since the advent of the BBC micro in the autumn of 1981, it has been my view that BBC BASIC is one of the best implementations of this language produced for any computer. There are various reasons for making such a claim, the control of graphics, the access provided to the Operating System, the opportunities for sound, and more. Above all, it is its support for structured programming that most appeals.

Look at almost any program written in BBC BASIC and you will see ample evidence of this approach. Typically, you will find a comparatively short main program, followed by large numbers of functions and procedures, and nary a GOTO or GOSUB in sight. Given that many users of BBC BASIC would not call themselves professional programmers, I take this wide scale adoption of structured programming to provide ample support for its benefits. Prominent among these must be that such programs are eminently more readable and understandable than those which make frequent use of GOTO and GOSUB. Understandable programs are far more likely to work, and much easier to modify in the future, if and when the need arises.

Despite that, there have been a number of omissions even in BBC BASIC until now. For example, the IF...THEN...ELSE statement has often been the source of confusion when used in a nested form. The impossibility of executing any built in loop structure (FOR...NEXT and REPEAT...UNTIL) less than once will also, I am sure, strike a chord in many. These are not the only areas where BBC BASIC is less than perfect.

Despite its shortcomings, BBC BASIC's widespread acceptance, particularly among educational users, has seen the release of BBC BASIC on other machines, notably the RM Nimbus, the Atari ST and the Apple Macintosh. Unfortunately, not all of the features of BBC BASIC that make the language so good, transfer sufficiently well onto other machines.

Now we have the RISC-based Archimedes, Acorn's latest range of personal computers. To accompany the Archimedes, Acorn has released a new version of the BASIC language called BBC BASIC V. BASIC V is clearly an evolutionary step in the development of BBC BASIC. Virtually all that existed before remains, even if some features are implemented quite differently, for example, the software simulation of Teletext mode 7. Many existing BBC BASIC programs will run without modification on an Archimedes, using ARM BASIC, not just under the 6502 emulator. In many cases they benefit from the enormous increase in speed that the Archimedes range provides.

The thing that really sets BASIC V apart from previous versions is the addition of several important programming structures, WHILE...ENDWHILE, CASE...ENDCASE for example, and, not before its time, a fully block-structured IF...THEN...ELSE. There is also a full range of matrix operations, improved parameter passing to functions and procedures, support for the new 256 colour modes, and the Archimedes palette of 4096 colours. This list by no means exhausts the new additions - a wealth of smaller details has substantially improved an already respected language.

Despite all these new features, there is, I believe, a very real danger that many Archimedes users, accustomed to using BBC BASIC on the BBC micro and other machines, will fail to appreciate the much richer programming environment that now exists with BASIC V. Thus this book, which might seem to have an obvious theme in documenting and explaining all that is new about BASIC V, will we hope also serve to show just what riches await the adventurous and imaginative programmer.

Another point to consider here is the openness of the Archimedes, and indeed any BBC micro. There is no difficulty, as with some machines, in accessing from BASIC the many Operating System routines, both within the OS ROM and in the many relocatable modules used to extend the Operating System. There was a great temptation to stray from the straight and narrow and attempt to cover all of these areas as well.

What I have done is to explain, as fully as possible, all the new features, large and small, of BASIC V itself. In addition, I have covered the means which BASIC provides to the programmer to go outside the confines of the BASIC language in order to exploit the whole of the Archimedes system. Apart from a few enticing tasters, these wider aspects are beyond the scope of this book. The boundary that I have drawn may at times see arbitrary, but fundamentally I believe that it has a sound logical basis.

I have included plenty of short examples, and tried to ensure that the new features of BASIC V are frequently included in them. Much can be learnt from other people's programs. Inevitably, you will find some new ideas being used before they have been fully described, and you may wish to follow any such new ideas where you come across them. This should cause no problems. The chapters do form a logical order, but each one is largely self-contained.

The book is aimed at those who have reasonable familiarity with programming in BBC BASIC. This is not a book for complete beginners, nor is it necessarily addressed to those who find their greatest interest deep in the bits and bytes of assembler. It is for the very large majority of Archimedes users who simply want to exploit this super machine to the best of their ability.

I hope you will learn something, and that you will get satisfaction from that learning process, and from putting your new knowledge into practice. Don't, however, be afraid to experiment. Some of the details in this book were only determined by extensive trial and error. Remember, there is no substitute for practical experience.

previous

 
© Alligata Media 2015