Home -> Magazines -> Issues -> Articles in this issue -> View
When Is A Computer? (Part 7) | |
Article from One Two Testing, May 1984 |
Language!
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.
Read the next part in this series:
When Is A Computer? (Part 8)
(12T Jun 84)
All parts in this series:
Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7 (Viewing) | Part 8 | Part 9
Power Dressing - The PowerPC |
The Art of Going Soft (Part 1) |
Power, Corruption & Spikes - Data Protection |
Software Support - Hints, Tips & News From The World Of Music Software |
PC Notes |
Networking |
Software Support - Hints, Tips & News From The World Of Music Software |
PC Notes |
Software Support - Hints, Tips & News From The World Of Music Software |
The Musical Micro - Additions To Traditions |
BeeBMIDI (Part 1) |
Software Support - Hints, Tips & News From The World Of Music Software |
Browse by Topic:
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)
BeeBMIDI Monitor (Part 1)
(EMM Oct 85)
BeeBMIDI Monitor (Part 2)
(EMM Nov 85)
Bopping With The BBC
(ES Aug 84)
Keeping Us Posted...
(ES Apr 84)
Soft Music
(ES Mar 84)
Technically Speaking
(MM Apr 87)
Browse category: Computer > Acorn
ATPL Symphony Keyboard - Add-on for BBC Micro
(EMM Mar 85)
Hybrid Technology Music 2000 System
(SOS Oct 88)
Hybrid Technology Music 4000
(MT Jul 87)
Soft Centres - MUSIC MATE/ATPL
(ES Jun 85)
Browse category: Keyboard - Peripheral > ATPL
Browse category: Keyboard - Peripheral > Hybrid Technology
Topic:
Series:
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
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!
New issues that have been donated or scanned for us this month.
All donations and support are gratefully appreciated - thank you.
Do you have any of these magazine issues?
If so, and you can donate, lend or scan them to help complete our archive, please get in touch via the Contribute page - thanks!