(Ebooks PDF) Download BBC Basic Reference Manual 3rd Edition Risc Os Open LTD Full Chapters
(Ebooks PDF) Download BBC Basic Reference Manual 3rd Edition Risc Os Open LTD Full Chapters
com
OR CLICK BUTTON
DOWLOAD NOW
More products digital (pdf, epub, mobi) instant
download maybe you interests ...
https://ebookmeta.com/product/risc-os-5-user-guide-2nd-edition-
acorn-computers/
https://ebookmeta.com/product/the-risc-v-reader-an-open-
architecture-atlas-david-patterson/
https://ebookmeta.com/product/basic-audiometry-learning-
manual-3rd-edition-mark-deruiter/
https://ebookmeta.com/product/our-railways-poster-bbc-full-steam-
ahead-victorian-railways-series-1st-edition-the-open-university/
The Basic Aerobatic Manual With Spin and Upset Recovery
Techniques 3rd Edition William K Kershner
https://ebookmeta.com/product/the-basic-aerobatic-manual-with-
spin-and-upset-recovery-techniques-3rd-edition-william-k-
kershner-2/
https://ebookmeta.com/product/the-basic-aerobatic-manual-with-
spin-and-upset-recovery-techniques-3rd-edition-william-k-
kershner/
https://ebookmeta.com/product/health-technology-sourcebook-3rd-
edition-health-reference/
https://ebookmeta.com/product/basic-english-3rd-edition-julie-
lachance/
https://ebookmeta.com/product/basic-georgian-3rd-edition-nana-
danelia/
BBC BASIC
Reference Manual
Copyright © 1992 Acorn Computers Limited. All rights reserved.
Updates and changes copyright © 2017 RISC OS Open Ltd. All rights reserved.
Issue 1 published by Acorn Computers Technical Publications Department.
Issues 2 and 3 published by RISC OS Open Ltd.
No part of this publication may be reproduced or transmitted, in any form or by
any means, electronic, mechanical, photocopying, recording or otherwise, or
stored in any retrieval system of any nature, without the written permission of the
copyright holder and the publisher, application for which shall be made to the
publisher.
The product described in this manual is not intended for use as a critical
component in life support devices or any system in which failure could be expected
to result in personal injury.
The product described in this manual is subject to continuous development and
improvement. All information of a technical nature and particulars of the product
and its use (including the information and particulars in this manual) are given by
the publisher in good faith. However, the publisher cannot accept any liability for
any loss or damage arising from the use of any information or particulars in this
manual.
If you have any comments on this manual, please complete the form at the back of
the manual and send it to the address given there.
Within this publication, the term ‘BBC’ is used as an abbreviation for ‘British
Broadcasting Corporation’, however the BBC is not affiliated in any way with this
manual.
All trademarks are acknowledged as belonging to their respective owners.
ii
Contents
Part 1 – Overview 1
About the BBC BASIC Reference Manual 3
Intended readership 3
Structure of the manual 3
Conventions used in this manual 4
Simple programming 15
Entering a program 15
Altering a program 16
Deleting whole programs 19
Numbering lines in a program 20
Listing long programs 21
Comments 22
Multiple statements 23
Saving and recalling programs 24
Variables 27
Types of variables 27
Naming variables 27
iii
Contents
Numeric expressions 29
Integers and floating point numbers 29
Special integer variables 31
Arithmetic operators 31
String expressions 39
Assigning values to string variables 39
Joining strings together 40
Splitting strings 40
How characters are represented 43
Converting between strings and numbers 43
Arrays 47
The DIM statement 47
Two dimensional arrays 47
Finding the size of an array 49
Operating on whole arrays 49
Array operations 52
Outputting text 55
Print formatting 55
The text cursor 58
Defining your own characters 60
Inputting data 63
Inputting data from the keyboard 63
Including data as part of a program 65
Programming the keyboard 67
Using the mouse in programs 69
Programming function keys 71
iv
Contents
Control statements 73
IF... THEN... ELSE 73
Operators 74
IF... THEN... ELSE... ENDIF 75
FOR... NEXT 77
REPEAT... UNTIL 80
WHILE... ENDWHILE 81
CASE... OF... WHEN... OTHERWISE... ENDCASE 82
GOTO 84
GOSUB... RETURN 84
ON... GOTO/GOSUB 85
v
Contents
Viewports 147
Text viewports 147
Graphics viewports 149
Sprites 151
Loading a user sprite 151
Plotting a user sprite 152
vi
Contents
Sound 159
Activating the sound system 159
Selecting sound channels 159
Allocating a wave-form to each channel 159
Setting the stereo position 160
Creating a note 161
Synchronising the channels 162
Finding the value of the current beat 163
Finding the current tempo 163
Executing a sound on a beat 164
vii
Contents
Index 503
viii
Part 1 – Overview
1
2
1 About the BBC BASIC Reference
Manual
B BC BASIC is one of the most popular and widely-used versions of the BASIC
programming language. This manual provides a complete description of BBC
BASIC for users of computers running RISC OS version 3.10 or later.
Intended readership
You should read this manual if you are
● a computer user who has never used BBC BASIC before, who wants an
introduction to a new computer language;
● an experienced programmer in other computer languages, who wants an
insight into BBC BASIC’s features without having to resort to a lengthy
tutorial-type manual;
● an experienced BBC BASIC programmer, who needs specific information about
the structure of BBC BASIC, and the use of its commands.
3
Conventions used in this manual
4
2 About BBC BASIC
5
BASIC versions
● BASIC V is the most commonly used interpreter. Each real number is stored
using 5 bytes of memory, and all real arithmetic is performed in software. This
version of BASIC is provided by the “BASIC” module.
● BASIC VI is an alternative interpreter that performs calculations involving real
numbers with greater accuracy. Real numbers are stored using 8 bytes of
memory, and arithmetic is performed in accordance with the IEEE 754 floating
point standard. Apart from increased accuracy, this also makes for easier data
interchange with other languages like C. There are in fact two different variants
of the BASIC VI interpreter, to cater for the two main floating point instruction
sets which ARM processors have supported over the years:
● The first variant of BASIC VI, provided by the “BASIC64” module, was
released with RISC OS 3.10 and is designed around the FPA instruction
set.
● The second variant of BASIC VI, provided by the “BASICVFP” module, was
released with RISC OS 5.24 and is designed around the VFP instruction
set.
If you do need to know more about real numbers, Appendix A – Numeric implementation
explains in detail how they are stored and manipulated, and gives details of the
differences between the FPA and VFP variants of BASIC VI.
BASIC versions
Different versions of the BBC BASIC interpreter provide different features. This
manual describes the features present in version 1.75 of the interpreter, as
included in RISC OS 5.24.
If you have an older version than this then you will need to obtain the latest
version from the RISC OS Open web site (http://www.riscosopen.org) as part of the
“System resources” archive. Open the archive and follow the instructions in the
ReadMe file to merge these updates with your !System.
To load the newer version of the BASIC V interpreter in place of the one in the
RISC OS ROM you will need to execute the following * Command:
RMEnsure BASIC 1.75 RMLoad System:Modules.BASIC
This should only be done once after the machine has started, and before entering
the desktop, because BASIC programs that run inside the desktop will stop working
if the BASIC interpreter changes whilst they are using it.
The recommended method for doing this is to create a file containing this
command, set its file type to ‘Obey’, and add it to the Choices:Boot.PreDesk
directory. Further information on the !Boot application and the PreDesk directory
can be found in the RISC OS User Guide.
6
About BBC BASIC
You will find a list of the differences between each released version of the BASIC
interpreter in Appendix I – BBC BASIC’s history.
Instructions to avoid
If you do decide to write a window managed program you must be careful to avoid
instructions in BASIC which will either interfere with the running of other programs
under the Wimp, or simply not work at all. These include:
7
Another random document with
no related content on Scribd:
The sea for a space. Hooray. Slim has just hung a
flashlight up for illuminating the compass. This light makes
the radium impossible to see. Soon it will be dark enough
without the flash.
* * * *
The faint light of the radium instruments is almost impossible to
see in dawn or twilight, when it is neither dark enough for the
contrast of the radium to show nor light enough to see the numerals
themselves.
* * * *
Log Book:
It is about 10. I write without light. Readable?1
1For reproduction of log book see page 305.
* * * *
Have you tried to write in the dark? I remember sitting up in bed
at school composing themes after lights. During those night hours
on the Friendship the log was written with the help of my good left
thumb. I would not turn on the electric light in the after cabin lest it
blind Bill at the controls. And so I pencilled my way across the page
of the diary thankful for that early training with those better-late-
than-never themes. The thumb of my left hand was used to mark
the starting point of one line. The problem of this kind of blind
stenography is knowing where to start the next line. It didn’t always
work. Too often lines piled up one on the other and legibility
suffered.
* * * *
Log Book:
The sea was only a respite. Fog has followed us since.
We are above it now. A night of stars. North the horizon is
clear cut. To the south it is a smudge.
The exhausts send out glowing meteors.
How marvellous is a machine and the mind that made
it. I am thoroughly occidental in this worship.
Bill sits up alone. Every muscle and nerve alert. Many
hours to go. Marvellous also. I’ve driven all day and all
night and know what staying alert means.
We have to climb to get over fog and roughness.
Bill gives her all she has. 5000 ft. Golly how we climb. A
mountain of fog. The north star on our wing tip.
My watch says 3:15. I can see dawn to the left and still
a sea of fog. We are 6000 ft. high and more. Can’t read
dial.
Slim and I exchange places for a while. All the dragons
and sea serpents and monstrosities are silhouetted against
the dawn.
9000 ft. to get over them.
The two outboard motors picked up some water a while
ago. Much fuss.
At least 10,000 ft. 13 hrs. 15 min. on way.
I lose this book in Major Woolley’s pockets.
There are too many.
* * * *
Big enough, that suit to lose myself in it. Size 40, and fur lined. It
is returned now, appropriately autographed. The Major has
threatened to stuff and place it in a museum.
* * * *
Log Book:
Still climbing. I wish the sun would climb up and melt
these homogeneous teddy-bears.
* * * *
Beside these grotesques in the fog, which we all remarked, there
were recurrent mountains and valleys and countless landscapes
amazingly realistic. Actually when land itself did appear we could not
be sure that it was not an illusion too. It really took some moments
to become convinced that it was reality.
* * * *
Log Book:
Slim has just changed bats in the flashlight hanging
over the compass.
* * * *
The compass was hung rather low, so far from Bill’s eye that it
was difficult to read its illuminated face. So Slim arranged a flash
light focussed on it.
* * * *
Log Book:
We are going down. Probably Bill is going through. Fog
is lower here too. Haven’t hit it yet, but soon will so far as
I can see from back window.... Everything shut out.
Instrument flying. Slow descent, first. Going down fast.
It takes a lot to make my ears hurt. 5000 now. Awfully
wet. Water dripping in window. Port motor coughing.
Sounds as if all motors were cutting. Bill opens her wide
to try to clear. Sounds rotten on the right.
3000 ft. Ears not so painful. Fog awful.
Motors better, but not so good.
It is getting lighter and lighter as day dawns. We are
not seeing it dawn, however. I wish I knew radio. I could
help a lot.
We are over stratum now.2 At 3000. Bill comes back to
radio to find it on the blink.
2
That is the way it is written in the log book. So far no one can
make out that word before “stratum.” Can you? A.E.
* * * *
So the log ends.
Its last page records that we had but one hour’s supply of gas
left; that the time for reaching Ireland had passed; that the course
of the vessel sighted perplexed us; that our radio was useless.
Where were we? Should we keep faith with our course and
continue?
“Mess” epitomized the blackness of the moment. Were we
beaten?
We all favored sticking to the course. We had to. With faith lost in
that, it was hopeless to carry on. Besides, when last we checked it,
before the radio went dead, the plane had been holding true.
We circled the America, although having no idea of her identity at
the time. With the radio crippled, in an effort to get our position, Bill
scribbled a note. The note and an orange to weight it, I tied in a bag
with an absurd piece of silver cord. As we circled the America, the
bag was dropped through the hatch. But the combination of our
speed, the movement of the vessel, the wind and the lightness of
the missile was too much for our marksmanship. We tried another
shot, using our remaining orange. No luck.
U. S. Shipping Board
THE FRIENDSHIP “BOMBING” THE AMERICA
THE LAST PAGE IN THE LOG BOOK
Should we seek safety and try to come down beside the steamer?
Perhaps one reason the attempt was never attempted was the
roughness of the sea which not only made a landing difficult but a
take-off impossible.
Bill leaped to the radio with the hope of at least receiving a
message. At some moment in the excitement, before I closed the
hatch which opens in the bottom of the fuselage I lay flat and took a
photograph. This, I am told, is the first one made of a vessel at sea
from a plane in trans-Atlantic flight.
Then we turned back to the original course, retracing the twelve
mile detour made to circle the steamer. In a way we were pooling all
our chances and placing everything in a final wager on our original
judgment.
Quaintly, it was this moment of lowest ebb that Slim chose to
breakfast. Nonchalantly he hauled forth a sandwich.
We could see only a few miles of water, which melted into the
greyness on all sides. The ceiling was so low we could fly at an
altitude of only 500 feet. As we moved, our miniature world of
visibility, bounded by its walls of mist, moved with us. Half an hour
later into it suddenly swam a fishing vessel. In a matter of minutes a
fleet of small craft, probably fishing vessels, were almost below us.
Happily their course paralleled ours. Although the gasoline in the
tanks was vanishing fast, we began to feel land—some land—must
be near. It might not be Ireland, but any land would do just then.
Bill, of course, was at the controls. Slim, gnawing a sandwich, sat
beside him, when out of the mists there grew a blue shadow, in
appearance no more solid than hundreds of other nebulous
“landscapes” we had sighted before. For a while Slim studied it, then
turned and called Bill’s attention to it.
It was land!
I think Slim yelled. I know the sandwich went flying out the
window. Bill permitted himself a smile.
Soon several islands came into view, and then a coast line. From
it we could not determine our position, the visibility was so poor. For
some time we cruised along the edge of what we thought was
typical English countryside.
With the gas remaining, we worked along as far as safety
allowed. Bill decided to land. After circling a factory town he picked
out the likeliest looking stretch and brought the Friendship down in
it. The only thing to tie to was a buoy some distance away and to it
we taxied.
CHAPTER IX
JOURNEY’S END
THE reception given us—and accorded the flyers who preceded us—
indicates, it seems to me, the increasing air-mindedness of America.
And it is not only air-expeditions, pioneer explorations and “stunts”
which command attention.
The air mail, perhaps more than any other branch of aeronautics,
has brought home to the average man realization of the possibilities
of aviation. Its regularity and dependability are taken for granted by
many. While our development of this phase of air transport is
notable, the United States is somewhat backward in other branches,
compared with the European nations. We lag behind the procession
in passenger carrying and the number of privately owned planes, in
proportion to our size.
© Wide World Photos
LANDING AT BURRY PORT—THE UBIQUITOUS AUTOGRAPH SEEKER
© International Newsreel
THE FIRST STEP IN ENGLAND. HUBERT SCOTT PAYNE HELPS ME ASHORE
Trouble in the air is very rare. It is hitting the ground that causes
it. Obviously the higher one happens to be, the more time there is to
select a safe landing place in case of difficulty. For a ship doesn’t fall
like a plummet, even if the engine goes dead. It assumes a natural
gliding angle which sometimes is as great as eight to one. That is, a
plane 5000 feet in the air can travel in any direction eight times its
altitude (40,000 feet) or practically eight miles. Thus it has a
potential landing radius of 16 miles.
Sometimes, a cautious pilot elects to come down at once to make
a minor engine adjustment. Something is wrong and he, properly, is
unwilling to risk flying further, even though probably able to do so.
Just so the automobile driver, instead of limping on with, say, worn
distributor points, or a foul spark plug, would do well to stop at once
at a garage and get his engine back into efficient working order.
All of which obviously points the necessity of providing frequent
landing places along all airways. Few things, I think, would do more
to eliminate accidents in the air. With perfected motors the dread of
forced landings will be forgotten, and with more fields, at least in the
populous areas, “repair” landings would be safe and easy.
Eliminating many of the expected sensations of flying doesn’t
mean that none are to be anticipated or that those left are only
pleasant. There are poor days for flying as well as good ones. Just
as in yachting, weather plays an important part, and sometimes
entirely prevents a trip. Even ocean liners are occasionally held over
in port to avoid a storm, or are prevented from making a scheduled
landing because of adverse conditions. In due time a plane will
probably become as reliable as these ocean vessels of today,
because although a severe storm will wreck it, its greater speed will
permit it to fly around the storm area—to escape dangers rather
than battle through them as a ship must do.
The choppy days at sea have a counterpart in what fliers call
“bumpy” conditions over land. Air is liquid flow and where
obstructions occur there will be eddies. For instance, imagine wind
blowing directly toward a clump of trees, or coming in sudden
contact with a cliff or steep mountain. Water is thrown up when it
strikes against a rock and just so is a stream of air broken on the
object in its way, and diverted upward in atmospheric gusts which
correspond to the spray of the seaside. Encountering such a
condition a plane gets a “wallop”—is tossed up and buffeted as it
rolls over the wave.
There are bumps, too, from sources other than these land shoals.
Areas of cool air and warm disturb the flow of aerial rivers through
which the plane moves. The “highs” and “lows” familiar to the
meteorologists—the areas of high and low barometric pressure—are
forever playing tag with each other, the air from one area flowing in
upon the other much as water seeks its own level, creating fair
weather and foul, and offering interesting problems to the students
of avigation, not to mention variegated experiences to the flyer
himself.
The nautical boys have an advantage over the avigators. Constant
things like the gulf stream can be labeled and put on charts and
shoals marked. But one can’t fasten buoys in the atmosphere. Flyers
can only plot topography. Air, like water, gives different effects under
different conditions. The pilot must learn that when the wind blows
over a hill from one direction, the result is not the same as that
when it blows from another. Water behaves similarly. The shoals of
the air seem a little more elusive, however, because their eddies are
invisible. If one could see a downward current of air or a rough
patch of it, avigating might be easier sometimes.
“Bumpiness” means discomfort, or a good time for strong
stomachs, in the air just as rough water does in ocean voyaging.
There is no reason to suppose, however, if one isn’t susceptible to
seasickness or car-sickness, that air travel will prove different.
Some of the air-sickness experienced is due to the lack of proper
ventilation in cabin planes. Many are not adequately ventilated for
with the opening of the windows, the heat and sometimes the fumes
of the motors are blown in. Adequate ventilation is one of the
amenities which the plane of the future will have to possess.
Perhaps the greatest joy of flying is the magnificent extent of the
view. If the visibility is good, the passenger seems to see the whole
world.
I have spoken of the effect of height in flattening the landscape,
always a phenomenon in the eyes of the air novitiate. Even
mountains grow humble and a really rough terrain appears
comparatively smooth. Trees look like bushes, and automobiles like
flat-backed bugs. A second plane which may be flying a few hundred
feet above the ground, as seen from a greater altitude looks as if it
were just skimming the surface. All vertical measurement is fore-
shortened.
The world seen from the air is laid out in squares. Especially
striking is the checkerboard effect wherever one looks down on what
his brother man has done. Country or city, it is the same—only the
rectangles are of different sizes. The city plays its game of checkers
in smaller spaces than the country, and divides its area more
minutely.
If one is fortunate enough to fly over clouds, another world is
entered. The clouds may be grey or white or tinted the exquisite
colors of sunset. Sometimes “holes” occur in them through which
little glimpses of the earth may be seen. It is possible to be lying in
sunshine and to look down on a piece of dull grey earth. There is
sport to be had playing hide-and-seek through the light fluffy clouds
that are not compact enough to be ominous. An instant of greyness
is followed by a flash of sunlight as one emerges into the clear air.
By the way, a flyer can dissipate a fairly small cloud by diving into it.
That is the fun of the clouds which look like “mashed potatoes.”
The big fellows can be much more serious. Once into them, and one
has the sensation of being surrounded by an everlasting mass of
grey, comparable, so far as visibility goes, with a heavy fog. In such
clouds one can find all varieties of weather—rain, snow, or sleet.
In the trans-Atlantic flight, we encountered both rain and snow.
There lies one of the greatest risks of long distance flying—I mean
moisture freezing upon the wings of the plane. The danger zone of
temperature is said to lie chiefly between twenty-four and thirty-
eight degrees, when slush begins to form. Once in trouble of that
kind, the pilot does his best to find warmer or colder temperature,
normally by decreasing or increasing his altitude.
As an example of the ice menace, I was told of a plane which
after a very few moments in the air was barely able to regain the
field whence it had taken off in a sleet storm, coming down with a
coating of ice which weighed at least five hundred pounds.
Speaking of ice, I am often asked about the temperatures in the
air. “Is it dreadfully cold up there?”
Recently a group flew from New York to Boston on one of the
hottest mornings of the summer. The temperatures at about 2000
feet were probably some degrees lower than those prevailing on the
ground. We all know that unless one encounters a breeze, often the
temperature on a mountain 5000 feet high is no more agreeable
than that at its base. In a small open plane, as contrasted to the
cabin ship, one would have a pleasanter time on a summer day, and
conversely more discomfort in cold weather. It parallels the
experience in an open car.
© Keystone Views
THE BOBBY SAID: “IF MY WIFE SEES THIS!”
© Keystone Views
OFF FOR ASCOT—MRS. GUEST AND HER SONS
WINSTON AND RAYMOND