APPLICATIONSCP/M ★ CODING - ARNOR C ★

ARNOR C|Amstrad Computer User)ARNOR C|Amstrad Action)Arnor C macht Dampf!|ASM)
 ★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se le presenta en su versión original ★ 
 ★ Dieser Text wird in seiner ursprünglichen Fassung Ihnen präsentiert ★ 

A is for Amstrad, B is for Binary
C is for programming with Rupert Goodwins looks at the trendy language in the mainframe world as supplied by Arnor for CP/M Plus.

COMPUTER companies sometimes generate a loyal following, as you are no doubt sick of hearing, Arnor has a special place in most CPC owners'hearts. This review is being written with Protext on a CPC664, in preference to an 80286 IBM compatible with a £450 word processing package, so they must be capable of doing things right.
One would hope that their C, which runs under CP/M+ on suitable CPCs and all PCWs, would be done right. But C is a language which can be got radically wrong. And the winner is...
Let's talk about C a little first. It is usually a compiled language, which means that a program is written using a text editor first, then turned into a runnable form by the compiler. CPC Basic is interpreted, which means that it is turned into a runnable form and run at the same time, every time. That's slower but more convenient for beginners and those who write small programs, who would find a compiled language both overly complex and unwieldy.

C GAINS a lot of flexibility from being compiled. It was designed (a fact that newcomers to the language find difficult to believe at times) to work in a similar way to the computer itself, but expressed in a form that programmers could understand without them having to learn the details of each separate machine. 
The way it stores information, the ways in which it passes data around and the methods used to loop and make decisions all have close parallels in the internal workings of most computers, if not programmers.

COMPOSING a C masterprogram takes time. With Arnor C, as with most Cs on most computers, the program goes through various stages on its way from brain to CPU. It starts out in a text editor (where it's called the source code), gets compiled to an intermediate form (the object code), and then gets linked up with various bits of machine code to form the final hunk of code that the computer runs (the executable image).
Unlike other Cs, Arnor C does this final stage every time you run your program, using a special interpreter. It's thus that exotic cross between normal compilers and interpreters, a semicompiler.
Semicompilers are exciting beasts. A significant acreage of computer science journals has been devoted to this subspecies, but for the CPC owner it can be described as producing code that is slightly slower than pure machine code.
For large programs, this code can also be smaller than the equivalent hand-tooled assembly language version. But you always need the run-time program to run a semicompiled program; like Basic you need both the language itself and the program you want to execute.

COMPILERS produce programs that can run by themselves. Arnor have produced a program that will turn your C program, once you've got it going and running in semicompiled form, into a stand-alone, fully compiled chunk of machine code. You can then distribute this to all and sundry, whereas the need for a runtime program limited the potential users of the semicompiled version to those who already had Amor C.
At the time of writing this review this extra program was not available, but Arnor says that it will be included in all Cs that it ships. A lot of the compiler apparently was developed using this program and the compiler itself (compilers are often compiled in this way, it's darned clever and deuced confusing).
The linking process (happens after compilation, remember?) takes the raw program you've just written and ties it in with other programs and the libraries. Libraries are sets of standard functions, screen handling, disc processing and the like, that every program needs to work. For example, the C function to write something witty on to the screen is called PRINTF (PRINT Formatted). It's used in much the same way as PRINT in Basic, but it's slightly cleverer. A typical use would be PRINTF ("My name is Gruntleworp."), which, brackets apart, is a dead ringer, for the Basic sibling command.

COMMANDS like PRINTF have to be identified. Every time you put PRINTF into a C program, the compiler remembers what it is you want to do, and leaves a marker there. It's up to the linker to find PRINTF in a library file, work out where it is and fill in the marker with a real address in the compiled program. But the linker usually includes the whole library in the final file, so you can end up with two line programs that link down to tens of kilobytes in length. C isn't designed for two-line programs . . .
Arnor C has a choice of four libraries, from which you can pick the ones that give you all the functions that you use without (hopefully) picking up too much extraneous baggage. The libraries are STDLIB.L, the full library, SMLIB.L which has most of the "standard" functions that all versions of C have, MINLIB.L has the bare minimum of simple, basic functions that you can still produce useful programs with, and MATHS.L is unsur-
prisingly the maths library.
Most programs don't use sines, cosines and all that gas, so it's nice to be able to leave the large library functions that provide that sort of service out.

COMPILED programs are big, even with the minimal library, you can end up with 13k or so of overhead on top of whatever program you've written. Silly for titchy progs, but once you get to about 30-40k of your program it starts to compete well with other options. And most of the functions in the full libraries are composed out of simpler functions from the minimal library, so you can always improvise them yourself, if you're desperate to do so.
This isn't the place to go into the mechanics and structure of the language. C cognoscenti will know that the bible was written by a couple of swells called Kemighan and Ritchie, and is referred to by all and sundry as "the C manual", or more simply as K&R. Arnor C claims to be a full K&R implementation, which means that any programs written in it will run on 99 per cent of C compilers on any computer. Including the big ones.

CONFINING a program to the features which are available on all computers is often a shame, so Arnor C also has extra functions to make efficient use of the CPC's screen and other attributes. These extensions make for easier programming, but will cause problems if you try to move your program onto another computer. This process, called porting, was one of the things that C was explicitly designed to make simple.
Arnor has also got functions that aren't in K&R, but are found on most C8. There is an advanced standard called ANSI C, which defines all the bits that K&R got (whisper it) a little wrong. Arnor C seems to be closer to ANSI C than K&R.

CONFIRMED Arnor addicts will like the editor supplied with Arnor C it's - surprise - Protext. Well, it's "a full implementation of the program mode of Protext", and as such is up to the job of creating C source. It does lack a few features found on more specific editors, for example Vedit (the editor I use to create C source code on my PC) has automatic indent and bracket matching.
Indenting is very important in creating readable and debuggable C source; although the language itself doesn't care where on the screen the instructions are, the human charged with keeping the code will find it impossible to read unless each new level is
shifted along an indent. For example, here's a fragment of C not indented...

and now here it is again, all nice and neat

You might also see how useful automatic bracket matching could be, C lives and dies by its curly brackets... But there are features built-in to the editor which make such minor omissions seem, well, minor.
The compilation stage of the programming process can be entered from the editor (by typing AC from the command line). During compilation, any errors that crop up force a return to the editor, where they can be fixed and the compilation started again. A very civilised way of writing C.

CONCURRENT editing means that you can edit two files at once, and allows you to copy blocks of text between them. This is massively useful, especially in C, when you often need to cannibalise old programs for useful bits that you don't fancy writing again. AC is much stronger than a mere compile command. It also links and runs the program, so during the later stages of debugging it turns into a nice environment under which the C freak can polish up his (I know of no female C freaks) creation. To a person such as I, used to skipping between compiler, linker and editor, scribbling down error messages on the back of the Guardian and losing my place, it is pleasant indeed. And it's all decently speedy, even on my minimal system.
The run-time system, called RUNC, is also capable of carrying out some basic functions to maintain the system, like disc housekeeping. But again it's much more flexible than it could have been, as compiling, linking and running a program can all be carried out from RUNC.

C tends to generate lots and lots of disc files. As well as the source code you wrote, there's the object file, the link file, various bits like the libraries and the compiler and editor itself. As a result, although you can make it all work on a single drive CPC6128 (or 464/664 with extra memory, as used for this review), a second drive is definitely good for the soul. And PCW owners with a second drive and oodles of M: will be laughing.
The manual is definitely for reference only. It does cover every aspect of the Arnor implementation quite thoroughly, including the black art of interfacing to machine code programs, but not going into gory details about memory allocation. There are several appendices, but NO INDEX. Bah. Fooey. A plague of guppies on Arnor's house.

COVERING the software is one thing, but trying to teach C is another. The manual does advise the beginner to get hold of and read several books on the subject before starting, advice I'd wholeheartedly agree with, although the books you'll need are often very expensive.
It also tries (especially in the editor section) to cover both the CPC and PCW editing keys simultaneously, with the emphasis on the latter. As an Arnoldian I was left at times a little confused and feeling a second class citizen. But all the information is in there somewhere, and I've seen (and written) much worse.

C is unusual in the CPC field, as mastering it gives the programmer a readily saleable skill which he can apply in the commercial sector. The same program that you write for Arnor C and your 464 will port across to a multi-hundred thousand pound IBM mainframe (but it won't have the graphics).
So C, like it or lump it, is a Good Thing. Arnor C v The Rest is a little more difficult to quantify, but thinking of it as a tutorial tool (albeit with the capability to produce useful programs) makes me feel that the editor/compiler interaction and general niceness are strong arguments in Arnor's favour.

For £50 it has to be worth every penny. In typical Arnor fashion, they've taken their time and got it right. 

Rupert Goodwins, Amstrad User October 1987

★ PUBLISHER: ARNOR
★ YEAR: 1987
★ CONFIG: 128K + CP/M(CPM plus only)
★ LANGUAGE:
★ PRICE: £49.95 (disk only)

★ AMSTRAD CPC ★ DOWNLOAD ★

Files:
» Arnor  CDATE: 2013-09-03
DL: 118 fois
TYPE: ZIP
SIZE: 334Ko

» Arnor  C    ENGLISHDATE: 2013-09-03
DL: 66 fois
TYPE: ZIP
SIZE: 336Ko

Advert/Publicité:
» Arnor-C-Maxam  2-BCPLDATE: 2015-01-08
DL: 317 fois
TYPE: image
SIZE: 330Ko

Je participe au site:
» Newfile(s) upload/Envoye de fichier(s)
★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
» Applications » Brainstorm Disc Utility
» Applications » Micrologic - Hotdog
» Applications » Disc And Title Utilities (Popular Computing Weekly)
» Applications » Brainstorm
» Applications » Turbo - Adress v2.0 (CPC Amstrad International)
» Applications » Strategy Software - Public Domain Disk Volume 4

QUE DIT LA LOI FRANÇAISE:

L'alinéa 8 de l'article L122-5 du Code de la propriété intellectuelle explique que « Lorsque l'œuvre a été divulguée, l'auteur ne peut interdire la reproduction d'une œuvre et sa représentation effectuées à des fins de conservation ou destinées à préserver les conditions de sa consultation à des fins de recherche ou détudes privées par des particuliers, dans les locaux de l'établissement et sur des terminaux dédiés par des bibliothèques accessibles au public, par des musées ou par des services d'archives, sous réserve que ceux-ci ne recherchent aucun avantage économique ou commercial ». Pas de problème donc pour nous!

CPCrulez[Content Management System] v8.75-desktop/c
Page créée en 067 millisecondes et consultée 602 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.