Magazine Archive

Home -> Magazines -> Issues -> Articles in this issue -> View

When Is A Computer? (Part 7)


One Two Testing goes multilingual as Andy Honeybone explores the mysteries of computer languages and what they all mean in plain 'N/glish.

A language in common is the biggest obstacle in the path of communication. Although this cynical phrase has been used to describe Anglo-American relations, it is equally true of computer languages and their lack of compatibility. How many of you have struggled to convert an alien BASIC to your own machine? Before we come to the gripes and hobby-horses section of this month's offering, let's have a butchers at the whys and wherefores of computer languages and round off with a prog to make your BBC micro churn out a delicately raunchy twelve-bar blues.

A language is a tool, a necessary evil, to make software. Unlike Tupperware, software is the ingredient which decides whether a computer will make a theatre booking or allow you to zap mutant camels. The earliest hobbyist micros supported no language and had no QWERTY keyboard. Instead they had a row of toggle switches and several banks of lamps. By setting the switches to the desired bit pattern and pressing 'LOAD', raw computer instructions could be chiselled into memory.

The level of the instructions was the lowest possible-machine code. A good knowledge of hexadecimal (numbers to base 16) was required and neat handwriting would certainly have been an advantage. In machine code the programmer is concerned with fetching bytes from memory, shunting the contents of the microprocessor's internal registers backwards and forwards, rotating the accumulator, simple addition and looking for equalities, carries and zeros. Fear not if these terms bewilder because that was the intention. Not only is machine code programming a very slow process but it also requires a knowledge of that particular microprocessor because they all work in different ways.

Hexadecimal numbers contain the numbers 0-9 and the letters A-F. A machine code program written in hex would be a string of these characters and very difficult to check for errors. To overcome this difficulty, mnemonics (memory-jogging abbreviations) are given to the micro's instructions so that programming can be performed in something more akin to English.

Typical mnemonics are JMP (jump), RET (return), JSR (jump saving return address) and MCV A,C (move contents of register C to the accumulator). A program written in this form must be converted to the form the microprocessor understands, and this is carried out by a program called an Assembler.

Because the mnemonics are copyright protected, each manufacturer has had to invent his own which further adds to the specialist knowledge required for this type of programming. Moral: don't bother!

As computers became more widespread, there came a demand for those unfamiliar with the workings of the machine to be able to write applications programs (payrolls, scientific, etc), and so were born the high-level languages ALGOL and FORTRAN. The first of these was named by the abbreviation of Algorithmic Language and this term referred to the block flow-diagram which was the method of solving a particular problem (hence the boxes inscribed on the top of a DX-7).

FORTRAN is an abbreviation of Formula Translator and was tailored toward scientific use. To turn the English-like phrases (statements) of these languages into machine executable code (3-star jargon rating), the text had to be fed into a compiler. This is yet another type of program which produces object code and invariably this code would need to be linked to a library of other utility programs to complete the translation.

These processes take an infuriating amount of time and debugging (removing errors) requires a full tank of midnight oil.

Because of the last point, BASIC was originally devised as a teaching aid for FORTRAN. The big difference was that BASIC was not compiled but was interpreted. An interpreter is a program that looks at the source text of the language line by line, checks for errors, converts the meaning to machine instructions and then acts on those instructions there and then.

The price paid for this instant language is the lack of speed relative to a compiled language. For example if a For... Next loop is set up for 100 repeats, then everything within that loop is checked for errors 100 times and converted to machine instructions – all very wasteful of processor time.

In a compiled language these operations are performed only once during compile time and not at all during run time. The advantage of interpreted languages is the ease with which program changes can be made by allowing the user to interact with the machine.

BASIC has enjoyed a great deal of success and is unlikely to be toppled. It enables results to be obtained quickly, is very friendly to the user, and where speed is not important, it has a lot to offer.

Where BASIC does come under fire is in the area of structure – it has very little. ALGOL was previously described as a block structure language which means that its form closely resembles the flow diagram of the program's algorithm. In BASIC there are no commands capable of translating this structure, and the result can become a tangled mass only intelligible to its originator for a few weeks after its creation.

BBC BASIC does make claims to being structured, but although it's good to call subroutines by name with the PROC statement, and write GOTO-less programs with 'repeat', 'until' and 'if... then... else' etc, it falls very short of the clarity possible with a block structured language such as PASCAL. Because PASCAL is compiled, it is unlikely to replace BASIC even if the necessary memory or disk drives become cheap enough.

To recap on the story so far, machine code and assembly language have been dismissed as unworkable; compiled languages attacked as impractical but well structured; interpreters received with open arms; and slow old BASIC damned with faint praise. What emerges is the requirement for a well structured, interpreted, fast language, and the one which fits the bill is FORTH.

It is the opinion of 'those who know', that FORTH is not a language but a tool for creating languages. As we're all in the market for a Music Composition Language, (MCL) then the picture becomes even more rosy.

FORTH is in fact a 'fourth generation' language whose name had to be shortened to fit the five letter file name limit on its original host computer. Many straight programmers despair of its strange ways and inconsistencies, but a large number become truly addicted.

It is an 'extensible' language which means that you can add commands to it and so create your own vocabulary of words related to your particular application – music!

On the minus side, FORTH has been called a write only language, meaning that it is virtually unreadable. This need not be so if careful layout and documentation are maintained. Some find fault with FORTH's reverse Polish notation where numbers are placed before the operator, ie 1 2 + rather than 1 + 2. To these critics we say 'yours up'.

When FORTH comes upon a number it puts it on a 'stack'. Conversely, when FORTH reads a number it pulls one off the stack. Access to the stack is only from the top, and new additions push older numbers further down. The stack is used to pass values between programs and by reducing the number of variables needed, the overall program runs faster.

FORTH defies neat categorisation as it has both an interpreter and a compiler. In the brief space here it would be impossible to go into too much detail, but hopefully the program example will be illuminating. Structure is imposed by defining words which are themselves composed of other lower order words. The final FORTH program is just one word – in this case 12BAR. This program gets the BBC micro to play a 12 bar blues.

The program was written in JWB FORTH which is a 'sideways' ROM that plugs into the BBC. It is available from HCCS Associates. Their address appears later. Those of you with Acornsoft FORTH should be able to convert the program if SOUND is substituted for NOTE.

First off, anything enclosed in brackets can be ignored as these are comments. The n1 and n2 symbols indicate that numbers are required on the stack for the word to operate. If you look at the bottom line of the second screen block, you will see the definiton of 12BAR. The words that make up this word are just the chord symbols of the changes. The colon to start and the semi-colon to finish are FORTH's way of invoking its compiler.

Once the program is loaded, typing 12BAR will produce the perfect background for you to warble 'I woke up this morning...'.

If more than one chorus is required, you'll need to make a new definition. Try:—:ENDLESS BEGIN 12BAR AGAIN.

Typing ENDLESS will now cause the sequence to repeat until you hit the break key. If you type E you will be rewarded with one bar of the E major vamp. You could line up a whole row of these chord symbols (providing they had been previously defined), and let the micro turn them into a song backing.

Although the same rhythm throughout drives you nuts after a short time, we have here some of the raw essentials of a Music Composition Language. Notice how repetition is easy.

Should this example have aroused your interest in FORTH, here are some useful contacts and references.

HHCS Associates, (Contact Details)

"Starting FORTH", Leo Brodie, Prentice Hall Inc.
"FORTH and the BBC Microcomputer" Richard de Grandis-Harrison, Acornsoft.

Series - "When Is A Computer?"

Read the next part in this series:

All parts in this series:

Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7 (Viewing) | Part 8 | Part 9

More with this topic

Browse by Topic:


Also featuring gear in this article

BBC Micro
(ES Feb 84)

BBC Reverb
(ES Feb 84)

BeeBMIDI (Part 1)
(EMM Jun 84)

BeeBMIDI (Part 2)
(EMM Jul 84)

BeeBMIDI (Part 3)
(EMM Aug 84)

BeeBMIDI (Part 4)
(EMM Nov 84)

BeeBMIDI (Part 5)
(EMM Dec 84)

BeeBMIDI (Part 6)
(EMM Jan 85)

BeeBMIDI (Part 7)
(EMM Mar 85)

Soft Music
(ES Mar 84)

Browse category: Computer > Acorn

Featuring related gear

Previous Article in this issue

Simmons Competition

Next article in this issue


One Two Testing - Copyright: IPC Magazines Ltd, Northern & Shell Ltd.


One Two Testing - May 1984




When Is A Computer?

Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7 (Viewing) | Part 8 | Part 9

Gear in this article:

Computer > Acorn > BBC Model B

Feature by Andy Honeybone

Previous article in this issue:

> Simmons Competition

Next article in this issue:

> Heroes

Help Support The Things You Love

mu:zines is the result of thousands of hours of effort, and will require many thousands more going forward to reach our goals of getting all this content online.

If you value this resource, you can support this project - it really helps!

Donations for May 2022
Issues donated this month: 0

New issues that have been donated or scanned for us this month.

Funds donated this month: £10.00

All donations and support are gratefully appreciated - thank you.

Magazines Needed - Can You Help?

Do you have any of these magazine issues?

> See all issues we need

If so, and you can donate, lend or scan them to help complete our archive, please get in touch via the Contribute page - thanks!

If you're enjoying the site, please consider supporting me to help build this archive...

...with a one time Donation, or a recurring Donation of just £2 a month. It really helps - thank you!

Small Print

Terms of usePrivacy