A Step Up?

Sean Taylor tries C on the 8-bit with DVC/65

 

Issue 26

Mar/Apr 87

Next Article >>

<< Prev Article

 

 

Since the launch of the ST, the fashionable language for use on these Atari computers has been 'C'. Languages of any description for the 8-bit machines however are, to say the least, hard to come by (ACTION and BASIC XL aside), however now the 8-bit user may sample the delights of this 'trendy' language with the DVC/65 'C' compiler.

PROGRAM OVERVIEW

The language comes supplied on a single double sided diskette, with a yellow and blue typeset booklet explaining the less standard functions of the system. On inspecting the booklet provided, it will become apparent that it is intended to be used as an appendix to the book 'The C Programming Language' by Kernighan and Ritchie. As might be expected the language implemented is a 'small' C, however the system does provide the facility to interface with 'ACTION!' and Assembler (namely MAC/65). The program diskette contains a variety of utilities and example programs, many of which may be run directly, although others require compiling first. On booting the diskette, you are greeted with a disk directory which loads and runs as an AUTORUN file. You are prompted for a program name and entering one of the demo names illustrates straight away the speed of the language. Before proceeding further the system disk should be backed up.

THE DOCUMENTATION

The documentation would appear to be the weakest point of the package. The 57 page booklet is adequate, but if you are new to C then it can be confusing. It would have been nice to have been provided with a complete function and word index, however the booklet does describe the functions it includes quite fully. The booklet may be considered as having three main sections, the first applying to the DVC compiler itself, the second to the use of the DVC system with the ACTION! cartridge, and the third with the use of the MAC/65 assembler. Again the text is direct and to the point, but the subjects are covered a little too briefly. The booklet does not pretend to be a tutorial, nor would I expect one, but I would have liked to have seen a few examples at least.

USING THE SYSTEM

DVC has some annoying anomalies, for example you cannot assign a value within a declaration, e.g. the expression

int val = 10

would have to be given as

int val;
val = 10

not crippling but annoying when errors arise at compile time. Probably of more interest, floating-point arithmetic is supported, but strangely floating-point numbers must be considered as character strings. If you are used to manipulating floating-point numbers in assembler using the operating system routines, then this may not seem so strange.

As an example, the expression

float number;

would have to be replaced by

char number[6];

This illustrates that several data type structures are not supported. however some very useful utilities are provided for program development.

The most essential is the editor. This is smart and easy to use with all commands readily available on a menu screen by pressing '?' and allowing single key entry for loading, renumbering, disk cataloguing etc. Further prompts are provided as required by the program editor. All programs are written using line numbers, these being more for the benefit of the program editor than the programmer. Some very useful keywords have been provided using a [CONTROL] [KEY] combination, for example pressing [CONTROL] and [P] will display printf(". These key combinations make program entry quicker and more pleasant.

The system supports a very powerful command line editor allowing programs to be loaded and arguments to be passed to them. For example:

D1:CC PROG LINK RUN

will load the compiler (CC.COM) which will then compile the program PROG.C LINK.COM will create the relevant .LNK and..COM files and finally the program PROG.COM, created by LINK.COM, will be run.

All program names are normalised, that is to say that only the name need be specified, the DVC system will take care of the name extender and drive number. The system uses a custom DOS. which is compatible with DOS 2.Os and DOS 2.5, however system files cannot be run without the DVC system DOS being present. The DVC DOS will only support single or double density disk format, the dual density mode offered by the 1050 is not supported.

THE DISK FILES

The diskette comes with a large selection of utility files, games and functions. The main COM files are provided on side A, including the system DOS. The system expects to find five forms of file name extender. These being .C to specify a text file,. .CCC to specify a compiled text file, .LNK to specify a link file, .OBJ for an object file from an assembler and .COM for a file that may be readily executed.

Several useful utilities are provided, allowing the creation of AUTORUN.SYS files, customising of DVC-DOS, reconfiguring the disk set-up, provision of a ramdisk for the XE and the 800XL using a Mosaic Ramboard. For most of the utilities and games provided the source code is readily available, allowing the utilities to be studied, altered and re-compiled. This freedom with the source files allows the author's programs to be studied and listed and also shows how to overcome some of the language anomalies.

Some very useful and amazingly fast graphics utilities have been included. They are best illustrated by running the graphic demo provided on the disk. These provide very fast drawing, plotting and circle drawing in graphics 8, running up to eight times faster than the normal functions also provided.

The system provides a very comprehensive set of functions for use with CIO. These hook directly to the operating system ROM and provide the versatility found when using these routines at machine code level.

HOW FAST IS DVC-'C'

A series of short benchmark routines were used, to compare DVC with Basic and GO-FORTH from SECS. In all cases the internal clock registers of the 800XL were used to produce the times shown.

BENCHMARK BASIC DVC-C FORTH
1 25 8 5
2 56 14 6
3 60 14 7
4 103 19 13
5 128 21 38
6 14 13 -

TIME/seconds

From these times it is apparent that 'C' provides a speed increase of upwards of 50% over basic. However, as might be expected, the short floating point routines do not show any marked improvement. For calculations involving numerous iterations then some improvement would be expected. The floating-point benchmark also illustrates how these functions have been implemented in the DVC system.

DIFFERENCES AND UNSUPPORTED FEATURES

DVC shows several features that are either different from Standard 'C' or not supported at all. These may be listed as follows.

1) Structures and unions are not supported.
2) Multidimensional arrays and pointer arrays are not supported.
3) Full Floating-point arithmetic is not supported.
4) Variable types int, char, extern only are supported.

5) Macro expansions in £defines and assignments within declarations are not supported.

6) Constant evaluation is performed at compile time. No order of precedence is given to arithmetic operators, all expressions are evaluated from right to left.
7) Variables may not be declared within a statement block.
8) All functions return a two byte word.
9) The braces, due to the lack of the graphic on the keyboard, are replaced with $( and $).

These are probably the more evident differences.

However for the most part they may be programmed around.

CONCLUSIONS

The DVC-'C' system does provide very good value for money. The sheer number of utilities and example programs provided on both sides of the disk support this. Early versions of the disk contain a corrupted LIFE.COM file, which will not load or run, however this may be corrected by copying the relevant (LIFE.CCC, LIFE.OBJ and LIFE.LNK) files to a work disk and running the file linker.

The one major criticism, is the strange way in which floating point arithmetic has been implemented. It poses the question, "If you went this far, why didn't you do it properly?". Also of relevance multidimensional arrays and pointer arrays are not supported. Quibbles aside, the system is pleasant and easy to use. More importantly it does support the claims made by all those trendies, the language provides structured, easily read source code, and even more to the point, if you understand Basic then you should pick up 'C' in no time.

Overall this package should be wholly recommended. Buy it you and you won't be disappointed.

DVC/65 is available from Mikes Computer Store, 292 London Road, Westcliff-on-sea, Essex SS0 7JJ

Figure 1 - BASIC Benchmarks

Figure 2 - C equivalents

Figure 3 - Floating Point routines in C

top