APPLICATIONSPROGRAMMATION ★ HISOFT - C FOR AMSTRAD ★

HISOFT - C FOR AMSTRAD (Amstrad Computer User)C COMPILER (c) HISOFT (PopularComputingWeekly)
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

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:

level0(p,num)
struct term *p;
int num;
{
struct term *q;
q=p
while (p-q<num) {
if (p->op_t==OPERT)
{
if ((p+1)->op_T==OPERT || p==q)
{
if (p!=q) ++p;
switch (p->elen)
{
case S_ADD: break;
case S_SUB: (p+1)->elem = -(p+1) ->elem;
                    break;
case S_NOT: (p+1)->elem = (p+1) ->elem;
                    break;
default : exprerr=ERR_MOND;
              return;
}
p->op_t=NULL;
}
}
++p;
}
}

What on earth does that do? I don't know, either!

The thing is, to get the best out of C, you do need to adopt the idiom with some amount of gusto. This involves the use of strange operators, odd-looking expressions and initially unfamiliar concepts. Things can be helped a great deal by spreading comments liberally around the program, and using sensible names for variables and functions. For some reason, though, wide use of comments seems to be the antithesis of good C programming.

The only concepts which really need to be understood well by a programmer who decides to delve into C are pointers and the fact that every expression, even assignment expressions (equivalent to LET statements in Basic) has a value. This latter part means that if we put a value into a variable,

variable=value:

then the expression ‘variable=value' has the value Value'. That isn't too difficult to get to grips with. Pointers are another matter, and it really isn't appropriate to go into great detail here, but essentially a pointer is a variable (more correctly, a value) which points to another variable. Seems pointless? It isn't as it makes such things as dealing with arrays and other complicated data structures far more simple and concise. As an example, suppose we had an array pointed to by S, which is full of values which we want to transfer to another array called T. To make it even easier, let's suppose that the last value we want to move is a zero. Dead simple, John:

while (*t + + = *s + + );

And that's all you need to say. It may look a little obscure, but it's a typical example of C-speak which even the novice C programmer will soon find himself getting to grips with.

Now, let's get back to Hisoft C on the Amstrad. At the moment, two versions of the compiler are being sold. They are both identical, but one comes on cassette and the other on disc. The cassette version costs £34.95, while the disc version costs £39.95. Remember that an equivalent product for almost all other machines will cost well over £150. For example, the most popular C compiler on the IBM PC, which is very nearly as good as Hisoft's C compiler, costs a mere £400.

For your money, you get a cassette or disc, which can of course be backed up for security but not for ripping off, and a hefty (and extremely well-written!) manual which deals with such subjects as the integral line-based screen editor, the use of the compiler, the fundamentals of the C language itself, and the numerous libraries of useful routines which Hisoft provides with its compiler. These libraries include the standard C library, which deals with all the normal C functions you expect to find, such as fopen, printf and isupper, and the dedicated Amstrad libraries to deal with graphics, sound and event handling. Anything which you can do in Basic, and almost everything which you can do in machine code, you can also do (more efficiently) in Hisoft C.

The program is loaded and run in standard fashion, with a line such as:

run"hisoft-c

and this invokes the compiler, enters mode 2 (80-column mode) and begins the editor. This editor is part of the compiler itself, and is much like the one provided with the Basic interpreter. It has a lot more features, though. Apart from simple things like renumbering, deleting, inserting and moving lines, you can save files, read files in, find and substitute strings, list files to the printer and so on.

Although the editor provides line numbers during an editing session, these line numbers are for the user's convenience only. C compilers have no concept of lines or line numbers, so the numbers are not saved when the file is put out to tape or disc. Once a file is in memory, it can be compiled by leaving the editor and ‘including' the file in a compilation. This is done with a special case of the ‘pre-processor command' #include, which normally directs the compiler to read in the named source file as part of the compilation. If no filename follows the directive, the file currently in memory is compiled. This can contain further # include commands, therefore bringing in header files and the library files.

Hisoft C is unusual in having the library files present in source (pre-compiled) form, which makes it very easy to alter certain functions to your particular needs, or to add further functions as you progress. It also obviates the need for a linkage editor, as there are no files to link. The end product of a compilation is a ready-to-run program, which may be run in situ or saved to disc or cassette to be run as a normal machine code program later on. The result of a compilation may also be sold in its own right, of course, and Hisoft asks for no more than an acknowledgment of its compiler's involvement in the production of the software.

One of the most interesting features of the Hisoft C compiler is its ‘direct mode' capability. This allows you to test out functions, modules or complete programs as you proceed, much as you can with interpreted Basic. Normally, a C program needs to be fully compiled before it is debugged, but the direct mode allows you to test each individual function as it is written.

The C compiler follows the Kemighan and Ritchie (they wrote the language in the first place) standard very closely, incorporating almost all the features of the language detailed, plus a few more which have been added since the book was written. This means that all the really useful parts of C, such as structures, unions, conditional expressions and so on.

One thing that is not present at the moment is the float data type. This means that floating point numbers cannot be used, but in practice this is far less of a disadvantage than it may seem. Hisoft intends to include floats fairly soon.

The file handling is very standard C, using the fopen() function to open files the and fclose() to close them. Reading and writing are done in the normal ways with functions like getc(), putc(), fgets and fputs.

As a test of the compiler, I typed in a long program which had previously successfully compiled on both the Sinclair Spectrum and the IBM PC. It compiled and ran without the slightest alteration, I'm glad to say, and subsequent similar tests all did the same.

The compiled programs run considerably faster than their Basic equivalents, and of course the libraries allow you to include all the special features of the Arnold's firmware such as EVERY and AFTER and all the juicy sound and graphics effects without any effort whatsoever.

It is very difficult to find fault with the compiler at all, funnily enough. The only annoying thing I found was that the screen is very difficult to read in 80 column mode, but this is a fault of the colour monitor rather than the C compiler. Considering that the whole things costs under £40, and includes as much as as any professional C programmer would expect, it has to be one of the bargains of the year.

It is unlikely that the huge popularity of the C programming language will die away in the near furture, and whether you want to learn to program in C or whether you are already an experienced C programmer who wants to work on an Amstrad, you would be well advised to buy this product before they run out of stock.

ACU

★ PUBLISHER: HISOFT
★ YEARS: 1985 , 1987 , 1988
★ CONFIG: 64K + AMSDOS+ CP/M
★ LANGUAGE:
★ LICENCE: COMMERCIALE
★ AUTHOR(S): ???
★ RERELEASE: Edité en 1987 en Yougoslavie sous le titre "AMSOFT Yu C-Language" , puis réedité en 1988

★ AMSTRAD CPC ★ DOWNLOAD ★

Files:
» HiSoft-C  Compiler  v1.2-AMSDOS    ENGLISHDATE: 2017-12-20
DL: 94 fois
TYPE: ZIP
SIZE: 124Ko
NOTE: Dump by Abraxas ; 41 Cyls
.HFE: OUI

» HiSoft-C  Compiler  v1.35-CPM    ENGLISHDATE: 2017-12-20
DL: 95 fois
TYPE: ZIP
SIZE: 176Ko
NOTE: Dump by Abraxas ; 41 Cyls
.HFE: OUI

Adverts/Publicités:
» HISOFT-High  Quality  Microcomputer  Software    ENGLISHDATE: 2015-01-08
DL: 453 fois
TYPE: image
SIZE: 148Ko

» Hisoft  C    (Two  Compilers  for  the  price  of  one)DATE: 2015-01-08
DL: 309 fois
TYPE: image
SIZE: 265Ko

» Hisoft  C    ENGLISHDATE: 2015-01-08
DL: 278 fois
TYPE: image
SIZE: 244Ko

Covers:
» Hisoft-C  for  Amstrad  v1.2    (Release  DISC)    (BINDER)    ENGLISHDATE: 2019-12-10
DL: 38 fois
TYPE: PDF
SIZE: 299Ko
NOTE: 3 pages/PDFlib v1.6

» Hisoft-C  for  Amstrad  v1.2    (Release  DISC)    ENGLISHDATE: 2013-09-03
DL: 172 fois
TYPE: image
SIZE: 134Ko
NOTE: 41 Cyls
.HFE: OUI

Media/Support:
» Hisoft-C  for  Amstrad  v1.2    (Release  DISC)    ENGLISHDATE: 2019-06-23
DL: 41 fois
TYPE: image
SIZE: 22Ko
NOTE: Uploaded by hERMOL ; w479*h592

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 » Blitz Basic Compiler
» Coding » Sdcc - 03 - Fichier Bat Pour Compiler Avec Sdcc
» Applications » Hisoft - Turbobasic (CPC Amstrad International)
» Applications » Micro Application - DB/Compiler + DB/Linker
» Applications » Pascal Compiler ROM (Amstrad Computer User)
» Applications » Hisoft Devpac80 v2

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.7-desktop/cache
Page créée en 116 millisecondes et consultée 1584 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.