★ APPLICATIONS ★ PROGRAMMATION ★ ARNOR BCPL PROGRAMMING LANGUAGE ★ |
ARNOR BCPL PROGRAMMING LANGUAGE (Amstrad Action) | ARNOR BCPL PROGRAMMING LANGUAGE (8000Plus) | Arnor BCPL (CPC Amstrad International) |
BCPL, often described as a systems programming language, is indeed very good for writing operating systems, compilers and word-processors. It is, however, an excellent general-purpose language. Designed by Martin Richards at Cambridge in 1967. it is one of the more mature languages available. Basic is usually an interpreted language. When a program is run, the Basic interpreter reads each line and executes the appropriate machine-code instructions. This happens as every single line is encountered, making Basic painfully slow when compared to a machine-code program. By contrast, BCPL is a composed language: the source-code must first be created using any editor or word-processor capable of creating an ordinary Ascii file. The package contains a rough editor to ran under CP/M (another for Amsdos), but I'd advise you to forget it and use your own favourite word-processor. The finished Ascii Die is then submitted to the compiler, which translates it into machine-code instructions. The machine-code can then be saved and ran. The disadvantage of a compiled language is that you have to wait for the program to be compiled each time before you can test it. Amor, up to its usual tricks, has made sure this is not a problem with its BCPL version: it compiles very rapidly. The CP/M version of the compiler takes a file containing BCPL source-code and produces a COM file containing an executable CP/M object-code program - there is no intermediate compilation stage. The Amsdos disk and ROM versions are identical (one is faster to start up than the other; that is all). The major difference between CP/M and Amsdos versions is that the CP/M version lets you include source files within other source files. The Amsdos version does not cater for this, but it allows the inclusion of stored text produced from Amor's Maxam or Protext. Basic and Pascal need many types of variable - string, integer, real. BCPL (nobody seems to know what the letters stand for) does away with this need, making it very powerful and flexible. Indeed there are no variable types - all variables are simple numbers; other types and structures are achieved by using the variables differently. As a result of this flexibility. BCPL lets the programmer access any part of memory (indeed any bit). Things can be done that are normally only achieved in machine-code. The price for this freedom is sparse error-checking: it is quite easy to program a jump to an illegal address without BCPL batting an eyelid. When you rush home with your new language and pull out the contents of the BCPL package, you will find a disk containing BCPL running under CP/M 2.2 or 3.1 on one side; the other side contains an Amsdos version. Or if you like things instantaneous. Amor has supplied a ROM as well. The CP/M versions will run on either CPC or PCW Amstrads. A BCPL program is mado up of a number of named procedures, each quite separate. There is one special procedure, called start, which must be present in every BCPL program - this is where execution will begin. More advanced terms include block and compound commands - words often thrown about when dealing with a structured language. Examples of other structured languages include C , Modula 2 and Pascal Locomotive Basic is most definitely not structured. As mentioned earlier, most languages have a number of variable-types. BCPL has just one internal variable type. This can be assigned a single-word value - a 16-bit pattern or two bytej The meaning attached to the variable is determined by the way tit programmer uses a. Following are short BCPL programs demonstrating how different variable types can be simulated; Integer Character String: The BCPL language is best considered in two parts. First the standard language, comprising the commands and syntax for expressions and constants. Second the input/output library routines, which are mostly procedures written in BCPL - these include printer, screen and keyboard drivers. Supplied on the disk are several utilities. The debugger is the most useful. It will help you develop and enhance your BCPL programs. The disk also contains several BCPL programs open to your scrutiny - even a playable space-invader game. By examining the programing techniques in these you should grasp, fairly quickly all the complexities of BCPL. BCPL is most likely to appeal to the user with Basic tucked, firmly under his hat, or even to the person that likes taking on a new challenge. Amor's clear, concise manual will have you programming confidently very rapidly. It's excellent value for money when you consider what you get: a completely new language on disk, a ROM thrown in as well a hefty manual, several useful programs (and a game) not forgetting countless enjoyable hours teaching yourself a new language. AMSTRAD ACTION #18 |
|