[comp.lang.c] The Name of C

TLIMONCE%DREW.BITNET@CUNYVM.CUNY.EDU (01/08/88)

Someone asked about BCPL still being alive in Amiga-land.  Yes,
Amiga developed the user interface (Intuition) over a DOS that
was very flakey.  Eventually, Metacommco tried to sell Amiga on
their 68000-based OS called Tripos.  Amiga liked it and bought it.
So basically, the underlying kernal of AmigaDOS is Tripos and Tripos
is written in BCPL.

Metacommco is an English company who (over there) is known for their
compilers, etc on 68000-based systems.  Tripos was based on the PDP-11
kernal and was developed as a grad project for one of the founders of
Metacommco.  His company later improved it.  (corrections are invited).

Before the latest wave of C compilers for the Amiga came out, to build
your own device driver (dameon) you needed to do it in BCPL.  I tried
reading some BCPL code and didn't understand it just like I couldn't
read C code until I found out what some of the symbols meant.

Since the user interface of the Amiga is done in C and the OS is in
BCPL things can get a little hairy.  As more-and-more of the parts of the
AmigaOS are down-coded into assembler there is less and less BCPL and
this problem is getting less-and-less. ...but the BCPL structure is
still in the roots of the Amiga.

This is why a lot of code for the Amiga has two typedefs.  APTR is a
pointer to anything (void *) and BPTR is a BCPL pointer.  Since BCPL was
geared towards the 68000 (or maybe just any 16/32-bit micro) they believed
that any pointer should only be on a 4-byte boundry.  If all your pointers
are on 4-byte boundries the two right-most bits are always going to be
zero.  Therefore, BCPL always shifts pointers to the right.  i.e.
#define C_TO_BCPL(x)    (x>>2)
#define BCPL_TO_C(x)    (x<<2)

Also, BCPL stores strings with a length byte... or is it length word?
I don't remember.

                              Tom Limoncelli
  Drew U/Box 1060/Madison NJ 07940     Bitnet: tlimonce@drew.BITNET
  Disclaimer: These are my views, not my employer or Drew Univesity.
--------------------------------------------------------------------------

awylie@pyr1.cs.ucl.ac.uk (01/11/88)

Your explanation of pointers being shifted is wrong - this implies not
that the pointers are on 4-byte boundaries, but that anything they can
point to must have this alignment. How then do you handle arrays of
chars (bytes)?

------------------------------------------------------------
Andrew Wylie, University of London Computer Centre,
20 Guilford Street, London WC1N 1DZ, England.

JANET:      andrew@uk.ac.ulcc.ncdlab
UUCP:              ..!mcvax!ukc!cs.ucl.ac.uk!awylie
ARPA:              awylie@cs.ucl.ac.uk
BITNET:     andrew%uk.ac.ulcc.ncdlab@ac.uk

If replying via satnet please give a UUCP path from mcvax to
your site.