I now have had a look at
Digital Precision C (look for "digic.zip") and I assume (I'm not sure!) that it also produces reentrant (perhaps even ROMable) code, cause it addresses all its code via address register A6 :-)
It's not a full K&R C compiler, but what i have read, mostly missing is: It's not allowed to reference a struct inside a struct:
Code: Select all
struct aStruct {
int *count;
char *str;
}; /* NOTE(!): Here the semicolon is REQUIRED(!) A dangerous pitfall of C/C++ */
struct invalidDigitalPrecisionCStruct {
struct aStruct unallowedMemberOfStruct;
};
There is an interesting chapter how to interface with Assembler. The beginning is:
Code: Select all
5. WRITING MACHINE CODE FUNCTIONS FOR USE FROM C
Writing machine code functions for DIGITAL C SPECIAL EDITION is
sometimes desirable for efficiency in speed and size. The existence
of this section on technique is in no way indicative that Digital
Precision offer any support at all for the writing of machine code
functions - in fact, we WILL NOT answer any questions whatsoever on
this topic. This section is only for very experienced machine code
programmers who already have an excellent understanding of M68000
machine code, who are fluent with the use of assemblers and who are
prepared to experiment and able to solve their own problems. We
recommend the use of the HiSoft assembler and our own IDIS SPECIAL
EDITION. Now you are on your own.
Reread section 4.16.4 .
5.1 Intermediate code
The DIGITAL C SPECIAL EDITION parser cc outputs a compact intermediate
code which is translated into 68008 machine code by the Code
Generator/ Linker, cg. The intermediate code consists of single byte
instructions followed by 0, 1 or 2 parameters. For example:
push pushes a value onto the stack and has no
parameters
load "name" loads the value of the variable called "name"
into a register.
Because of the need to link separate modules together, and because
variables and/or functions referred to may be in different modules,
the names of variables and functions must be contained in the
intermediate code as ASCII strings. If you copy an "_obj" module to
the screen, you will see names intermingled in the code. It is the
task of cg to resolve all inter-module references. This contributes
to making writing machine code functions somewhat tedious!
5.2 Register usage
DIGITAL C SPECIAL EDITION compiled code does not use all the 68008
registers. However, the majority of the library functions supplied in
std_lib are in machine code. Hence it is sensible not to rely on
registers holding values between functions, except as described below.
Compiled code uses these registers:
A5 dsp Data stack pointer, used to point to the top of the data
stack, as distinct from the A7 stack. Ensure the value of
Unfortunately it seems, that DPC does NOT use standard SROF (Sinclair Relocatable Object Format – i.e. the GST Linker, which is also the native object format of the Atari ST), but an own. So most probably no chance to link it with the excellent GST Macro Assembler :-(
I'm currently working on a new EJC compiler driver (LCC – Lattice C Compiler driver) which uses the Lattice C from PDQC. It seems to have a lot of improvements, especially the -i command line option, which allows to specify include directories :-) I'm of good hope, that it can be used with the libs of EJC.
BTW: Is the mentioned HiSoft Assembler now freeware? If not, does anyone know the author? It's a good Assembler, Boris Jakubith (inventor of the HIST device - now even included [but limited] in QPC2) has used it as its standard assembler.