Contents / Part 1 / Previous chapter / Next chapter / Index


2 Commands

There are two ways of getting the computer to do something:

  1. Give it commands which it can act on straight away. This is what happened when you typed in the lines in section 1.
  2. Give it a series of numbered instructions, often called statements, which it can store in its memory and carry out in sequence when told to do so. A stored series of instructions is called a program.

Many of the keywords in BASIC: can be used both as commands and as statements in a program.

The rest of this section is concerned with 'command mode'.

PRINT is used to make the computer print something on the screen. Try these two examples:

PRINT "HELLO"

don't forget to press RETURN at the end of each line.

PRINT 3+4

In the second example you have given the computer a command to print the sum of 3 and 4. The computer can very easily do addition, subtraction, multiplication and division. The addition, subtraction, multiplication and division signs are all on the right side of the keyboard. If you are interested in doing mathematical or financial work then you will need to know the symbols that the computer uses for various mathematical things. They are:

+ addition
- subtraction
* multiplication
/ division
^ raise to the power
. decimal point

If you want to get the + or * then you will have to press the SHIFT key as well as the key you want. It's rather like a type-writer: while holding the SHIFT down, press the + sign quickly once.

Try typing in the following and check that they work, in other words see that they produce the expected answers.

PRINT 4+8

PRINT 18 - 2 * 4

PRINT 131/4

PRINT SQR(2)

The last one will print the square root of 2 which is 1.41421356. Then try

MODE 5

which will make the computer clear the screen and get it ready to draw lines as well as text. In this mode

COLOUR 129

will select a red background, and

CLS

will clear the screen to the background colour. In each case you have given the computer a command and it has obeyed it immediately. Working like this is called "working in command mode".

While in this mode you might like to learn how to use the bright red user defined function keys. Each of these keys can be users to store a word or several words. For example they could be programmed so that each one selects a different colour. Try this

*KEY 2 COLOUR 2 ¦ M

The ¦ shown above is produced by a special key. On the keyboard this key is the third key from the right on the row below the red keys. In Mode 7 this key produces ? on the screen.

Once you have typed that in then every time you press the key marked f2, the computer will change to COLOUR 2 which gives yellow lettering. In a similar way you could program some of the other keys like this:

*KEY 0 COLOUR 0 ¦ M

*KEY 1 COLOUR 1 ¦ M

*KEY 3 COLOUR 3 ¦ M

Note the exact position of spaces in what you type in.

Of course red letters don't show up very well on a red background! You will have noticed the ¦M at the end of each line above. That is the code used to get a RETURN into the User Defined Function Keys.

If the picture on your television screen is either too far up or too far down the screen, you can move the whole display with the command *TV.

*TV 255 will move down one line

*TV 254 will move down two lines

*TV 1 will move up one line

*TV 2 will move up two lines

The movements come into affect next time you press BREAK or change MODE.

Exit: BBC Microcomputer User Guide; Kasoft Typesetting; Archer


The BBC Microcomputer User Guide was written by John Coll and edited by David Allen for the British Broadcasting Corporation.

Optical character recognition and original formatting effort by Mark Usher.

HTML version maintained by: Kade "Archer" Hansson; e-mail: archer@dialix.com.au

Last updated: Monday 12th February 2001