|★ APPLICATIONS ★ PROGRAMMATION ★ HISOFT - C FOR AMSTRAD ★|
|HISOFT - C FOR AMSTRAD (Amstrad Computer User)||C COMPILER (c) HISOFT (PopularComputingWeekly)|
Note: The author of this article was also involved in the production of the manual for Hisoft C, but promises not be obviously biased.
Amstrad users are very lucky. We've always had a great machine which is being taken seriously by a lot of very important people, but now there is a product for the CPC464 and CPC664 which, more than almost any other single software item, brings it credibility on a grand scale. The product is a Unix-compatible C compiler, written and sold by Hisoft.
Why is C such an important product? Although the C language has been around for almost fifteen years now, it has only really taken off in the last couple of years. The main reasons for this are: 1) it is very trendy, and 2) it is the basis of the multi-user multi-tasking operating system, Unix. Hisoft's C is substantially compatible with the standard C compiler which is supplied with all Unix systems. This does not mean that someone somewhere is going to move the Unix operating system across to the Arnold, but it does mean that programs written with the Hisofl C compiler are very likely to compile without alteration on these other (very expensive) C compilers. This has two advantages for the Amstrad owner. It means that he can develop programs on his machine and use the knowledge gained in doing so as the basis for a career in systems programming on much larger machines. At the same time, it means that almost all the books written about C, and almost all the programs published in the language, can be applied to or run on the Amstrad.
Let's look at the C language and see why it has suddenly become so popular. First of all, it is the ideal language in which to write systems programs in. A system program is one which interfaces between the low level of the computer, such as the screen drivers and disc interface, and the applications program, such as a word processor or a game. An obvious example of a systems program on the Amstrad is its operating system. The operating system deals with all the arduous things such as printing to the screen, writing to and reading from the cassette and discs, and making the sounds and noises which the Amstrad is so capable of.
C is particularly good at this sort of thing because it places constraints upon the programmer. In much the same way as assembler, the C language lets the programmer get hold of any aspect of the system, no matter how low level it is, and do with it what he wishes. More importantly, perhaps, the C language has no built-in routines to deal with input and output.
This may seem rather silly at first, but it has enormous advantages over languages like Basic, but things like PRINT and INPUT are built-in parts of the language. C deals with I/O (input/output) by having a set of standard library functions which do things like read data in and write it out.
As these functions are part of a library rather than part of the language itself, they can be tailored to run on any machine without having to play around with the actual compiler, or producing yet another dialect of the language which does things in a different way. After all, consider just how many different versions of the Basic language there are, and then consider how differently they handle things like printing and inputting data. Horrifying, isn't it?
C doesn't have this problem. There is, in theory and very nearly in practice too, one version of the language. Every real C compiler will come equipped with standard things like while loops, switches and case statements, and structures. Don't worry about these terms - they'll be explained later on. The input and output routines, as they are part of the ‘standard' library, can be configured to work in exactly the same way on each machine they appear on.
In the case of Hisoft C, this means that you could write a program on the Amstrad, and watch it run in just the same way on a ZC Spectrum, a CP/M machine, and so on. If you think that this is wonderful, as you intend only writing programs for the Amstrad, don't worry. C has advantages for this sort of application, too.
Its advantages over Basic are that it is compiled, which means it runs faster and takes up less space in the machine and that it is more versatile. No matter what you think of Locomotive Basic, it can never be considered as powerful a language as C. This is because C can do more things than any Basic could ever hope to achieve.
Its edge over other compiled languages, such as Pascal, is again this concept of a ‘powerful' language. Pascal compilers, by definition, will not allow you to play around with data with the same wild abandon as a C compiler will. It tells you off if you try to access an element of an array which doesn't exist. C doesn't, because it may well be that the entire array is notional anyway, and you've only introduced it to the program because it is the easiest way of deaing with the problem you want to solve. Okay, this certainly means that the C programmer has to be far more responsible and much more in tune with what is being done, but you can see why programmers have taken to it so completely.
C's lead over assembly language programming is that it is block structured, and far easier to write and debug. A block structured language is best expressed as one which allows you to write programs in modular fashion. True, this could be done in assembler by writing everything as small subroutines, but if you do this you quickly lose the advantages of programming in assembler anyway.
C does share one problem with assembly language programming, though - it can easily become unreadable. As an example, take this segment of a typical C program:
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.7-desktop/cache
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.