TinyC, port to HP

From: Holger Veit <holger.veit_at_ais.fhg.de>
Date: Mon Oct 13 09:25:23 2003

On Fri, Oct 10, 2003 at 01:00:32PM -0600, ben franchuk wrote:
> Jay West wrote:
> > I am looking for full source code for a *VERY* tiny C compiler written in
> > any common assembly language. I'm much more concerned with size of the
> > compiler than functionality/features. Can anyone suggest one or know where
> > the source might by laying around? I thought I had heard ages ago about some
> > microcomputer C compilers being well under 32K.
> >
> > As to how this relates to classiccmp... well.. *blush* I'm actually thinking
> > of porting C to the HP2100. The whole thing has to fit in 32K of ram,
> > including drivers, etc. Not sure what OS it will be placed on, perhaps
> > HP-IPL/OS. Might make a simple native OS for it or might even make it
> > standalone, not sure yet.
>
> C requires a stack pointer and a index register.Offhand I don't think
> your hardware supports that.

Certain HP2xxx do have index registers (the ones with the EIG instructions
IIRC), but guess how FORTRAN compilers handle indexed array accesses
(this is pointer math). There is FORTRAN for HPs, so it is possible
(there are microcode extensions for HP1000 to speed up multiple dimensional
array acesses, but you don't really need them in all cases).

There is C for the HP/1000 available from interex.org (HP1000 CSL) which
has been released some time ago. This was written for RTE-IVB or RTE-6/VM,
it might be portable to pre-MEF machines.

C does not need a stack pointer although the original PDP implementaions
took advantage of it. It is attractive to base one's parameter passing
on a stack data structure, including recursion, but you can always
replace this by different structures for housekeeping.

> The Honeywell H316 had a high level langauge PL516
> that might be easyier to port.
> http://www.series16.adrianwise.co.uk/
> The PDP-8 is said to have a pascal compiler, that may
> be another idea.

Pascal, in particular because of its procedure nesting, and thus
a rather tricky way of accessing variables in higher-level scopes,
is much more relying on a stack than C does. The PDP-8 and the HP2xxx
are with this respect both dumb in a similar way. And if it works with
a PDP-8....

Holger
Received on Mon Oct 13 2003 - 09:25:23 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:36:23 BST