Hello World - BBC Basic

BBC Basic was created for the BBC Micro computer in 1981. This home computer was also used in schools. Learn how to say Hello World!

Hello World - BBC Basic

Well now we're into languages older than me. 1981 was the year a language written to run on a platform which arguably inspired the Rasperry Pi was born. An 8-bit, 2MHz home computer platform which was also widely used in educational settings, the BBC Micro was a hugely successful peice of equipment - sales of over 1.5 million are reported.

Despite the BBC Micro platform itself being discontinued in 1994, stable releases of the BBC Micro language are still being created. You can read the Raspberry Pi article above which takes you through a basic helicopter game tutorial - but how about we start with something more simple?

The BASICs...

10 CLS
20 PRINT "HELLO WORLD"
30 GOTO 10 

So what's going on here? If you've programmed in a modern language (anything after say... 1994), you might notice some oddities. For starters, you have to put the line numbers in yourself. And the code executes in the order of your line numbers!

The above code could be typed in this order, and work exactly the same:

20 PRINT "HELLO WORLD"
10 CLS
30 GOTO 10

Try the LIST command to see the whole program in the order of execution.

If you've been following so far you will notice we've incremented in lumps of 10 lines - that's intentional and advised practise. If you've missed something out... the only way to put something in the gap is to insert it with an integer line number. So we can add:

10 CLS
11 PRINT "HELLO LADIES AND GENTLEMEN"
20 PRINT "HELLO WORLD"
30 GOTO 10

The other amusing factor here of course, is by having line 30 as GOTO 10, we've ensured the computer will run our little program for ever and ever, until the computer is reset.

What's actually going on?

Underneath the somewhat unforgiving user interface (which just prints "Mistake!" if you get something wrong), BBC BASIC is an interpreted language. This converts the typed text into machine code for execution. A somewhat unique feature of the BBC BASIC language was its ability to interpret and compile assembler code within an application. In various cases this allowed BBC BASIC to execute faster than Microsoft BASIC at the time.

You can't mention BBC Basic without mentioning Sophie Wilson - key to the design of the BBC Micro and BBC Basic, Wilson also played a critical role in the design of the ARM architecture. In the modern world, you are probably never more than a meter away from an ARM chip unless you really try hard to go off-grid!

Online interpreters

We had a play with https://bbc.godbolt.org/ for our foray into BBC Basic above - have a go for yourself!