[net.micro.amiga] Some remarks to AmigaDos.

claudio@ethz.UUCP (Claudio Nieder) (10/21/86)

[E t th s  ne i   ou ca . ]

We already had some discussions about AmigaDos. Here some new comments,
but this time NOT about the filesystem.

We tried to write a program dosspy which should monitor some
AmigaDos calls. We first used SetFunction to change the library pointer
to our routines and to get the address of the original routines.
This didn't work because SetFunction assumes that the code vectors are

			JMP abs.L

and returns you the last 4 byte of the 6 byte entry. AmigaDos has
another entry:

			MOVEQ.L #byte,D0
			BRA	libStart+$4E

A function dispatcher at libStart+4E will call the desired function
according to the value of byte.

After mastering this problem we tried our dosspy with some programs
and several dos commands. It worked with programs, but displayed
nothing with dos commands. It seems that commands (as rename)
doesn't call dos.library through the library vectors. To find out more
we disassembled rename. Here the first 3 instructions of rename:

			MOVEA.L	$164(A2),A4
			MOVEQ.L $C,D0
			JSR	(A5)

Seems that a program starts not only with A0 pointing to the arguments
and D0 indicating the number of the characters in the argument. At least
A2 and A5 are initialised with some magic values pointing probably to
the function dispatcher (A5) and to some global values (A2) of AmigaDos.

So if anybody ever had the idea to exchange the AmigaDos function by
own functions (e.g. try to implement a second filesystem which would
coexist with the present one and be transparent to the user) he will
have to rewrite all dos functions !

-- 
				claudio

(* ---------------------------------------------------------------------
 Disclaimer: I'm not working for ETH-Zurich! I'm just a CS student.

E-Mail: UUCP:   claudio@ethz.uucp
        BITNET: K538912@CZHRZU1A
  Mail: Claudio Nieder, Kanalweg 1, CH-8610 Uster, Switzerland.
--------------------------------------------------------------------- *)

dillon@CORY.BERKELEY.EDU (Matt Dillon) (10/23/86)

>So if anybody ever had the idea to exchange the AmigaDos function by
>own functions (e.g. try to implement a second filesystem which would
>coexist with the present one and be transparent to the user) he will
>have to rewrite all dos functions !

	BCPL programs, it seems, communicate directly with DOS via their
process's message port (every process has one).   On the Amiga, anything
having to do with BCPL is non-standard relative to the rest of the machine.

	I believe all the DOS library does is talk to DOS through your 
process's message port.

						-Matt

phils@tekigm.UUCP (Phil Staub) (10/24/86)

In article <8610231957.AA13424@cory.Berkeley.EDU> dillon@CORY.BERKELEY.EDU (Matt Dillon) writes:
>
>	BCPL programs, it seems, communicate directly with DOS via their
>process's message port (every process has one).   On the Amiga, anything
>having to do with BCPL is non-standard relative to the rest of the machine.
>

I can't stand it any more! All this talk about BCPL, and the only thing you
find in the Amiga literature is references to bits and pieces about the
tip of the iceberg indicating the BCPL roots of AmigaDOS. Three questions:

1. Why was so much of AmigaDOS written in BCPL?

2. How does one go about programming in BCPL on the Amiga.
If it is with some stuff the developers got, but we ordinary users don't
have access to, is there any plan to make a BCPL programming package
available to the general user?

3. Where do you find some reference material on BCPL, since it's not one of
the current "in" languages?

(Sorry to pick on you for an example, Matt, but you seem to be doing a lot
of posting of articles pertaining to BCPL, so I snagged one of your articles
to cite)

Thanks for preserving my sanity,

Phil Staub
Tektronix, Inc.
ISI Engineering
P.O. Box 3500
Vancouver, Washington 98668
C1-904, (206) 253-5634
..tektronix!tekigm!phils

papa@bacall.UUCP (Marco Papa) (10/27/86)

Phil Staub writes:

> 
> 1. Why was so much of AmigaDOS written in BCPL?

I guess most of AmigaDos was written in England where BCPL originated.

> 
> 2. How does one go about programming in BCPL on the Amiga.
> If it is with some stuff the developers got, but we ordinary users don't
> have access to, is there any plan to make a BCPL programming package
> available to the general user?

No, "official" developers like me did not receive ANY BCPL programming
package.  MetaCompco, the company that did Alink, the Assembler and probably
AmigaDOS, has listed among its offerings a BCPL compiler, but instead of
the price listed has something like TBA (to be announced?).  I don't have their
tel. no. handy, but I can find it if needed.

> 
> 3. Where do you find some reference material on BCPL, since it's not one of
> the current "in" languages?
> 

There are a couple of books from England that describe BCPL. Look in a 
University Computer Science Library.
You might also want to look for references to the
'B' language which originated from BCPL, and then later was the basis for the
'C' programming language.

Marco Papa
Felsina Software

dillon@CORY.BERKELEY.EDU (Matt Dillon) (10/27/86)

>(Sorry to pick on you for an example, Matt, but you seem to be doing a lot
>of posting of articles pertaining to BCPL, so I snagged one of your articles
>to cite)

	Only because I'm going slowly mad trying to figure it out too.  The
way I see it, the BCPL stuff is a total hack and hopefully will eventually
be phased out completely.

	Apart from the endless hours I've spent trying to get it to work
with various things, I have no experience with BCPL.  I do not intend get
a compiler for it or to learn it.

					-Matt

	

eric@topaz.RUTGERS.EDU (Eric Lavitsky) (10/27/86)

Hi,

 For a "reasonable" explanation of why AmigaDOS was written using BCPL
and how the Amiga evolved in general, I would suggest getting a hold
of the February 1986 issue if Byte magazine.  Page 321 - "TRIPOS-The
Roots Of AmigaDOS" - There is also an article by RJ Mical in the same
issue giving an introduction and overview of the Amiga ROM Kernel.

Eric
-- 
ARPA:	LAVITSKY@RUTGERS or LAVITSKY@RED.RUTGERS.EDU
UUCP:	...{ihnp4,pyrnj}!topaz!eric
	...hplabs!well!lavitsky
	...{decvax,seismo,allegra}!ulysses!eric

kim@amdahl.UUCP (Kim DeVaughn) (10/28/86)

In article <8610270411.AA05734@cory.Berkeley.EDU>, dillon@CORY.BERKELEY.EDU (Matt Dillon) writes:
>>(Sorry to pick on you for an example, Matt, but you seem to be doing a lot
>>of posting of articles pertaining to BCPL, so I snagged one of your articles
>>to cite)
> 
>      Only because I'm going slowly mad trying to figure it out too.  The
>way I see it, the BCPL stuff is a total hack and hopefully will eventually
>be phased out completely.
> 
>      Apart from the endless hours I've spent trying to get it to work
>with various things, I have no experience with BCPL.  I do not intend get
>a compiler for it or to learn it.


Something I find rather curious is that in Metacomco's product literature,
they indicate they currently have a BCPL compiler for the Atari ST's;  the
BCPL compiler for the Amiga will be available "soon".

What's curious about this is that Metacomco wrote AmigaDOS (nee Tripos) in
BCPL, yet their compiler isn't available for the Amiga, but is available
for the ST ... hmmmm.

Seems pretty bass-ackwards to me ... anyone know why (Matt?)

Also (to reiterate Matt's question of a couple of weeks ago), how come CBM
is so closed-mouthed about anything to do with BCPL, when they are so very
helpful with everything else?

/kim


-- 
UUCP:  {sun,decwrl,hplabs,pyramid,ihnp4,seismo,oliveb}!amdahl!kim
DDD:   408-746-8462
USPS:  Amdahl Corp.  M/S 249,  1250 E. Arques Av,  Sunnyvale, CA 94086
CIS:   76535,25

[  Any thoughts or opinions which may or may not have been expressed  ]
[  herein are my own.  They are not necessarily those of my employer. ]

hamilton@uiucuxc.CSO.UIUC.EDU (10/28/86)

phils@tekigm (phil straub) says:
> I can't stand it any more! All this talk about BCPL, and the only thing you
> find in the Amiga literature is references to bits and pieces about the
> tip of the iceberg indicating the BCPL roots of AmigaDOS. Three questions:
> 
> 1. Why was so much of AmigaDOS written in BCPL?

    AmigaDos was written by MetaComco, a british software house.  BCPL was
developed in britain (the "c" stands for "Cambridge").  BCPL isn't the worst
language i've ever seen; i'd prefer it to Cobol or Basic or Pascal.  many
of the concepts we take for granted in C were pioneered in BCPL.
    BCPL isn't solely a british dialect.  it was used extensively at
Xerox Parc about 10 years ago, for operating system R&D.

> 2. How does one go about programming in BCPL on the Amiga.
> If it is with some stuff the developers got, but we ordinary users don't
> have access to, is there any plan to make a BCPL programming package
> available to the general user?

    all the developers i know did _not_ get a BCPL compiler.  i'm not even
sure the folks at c-a have one for use in-house.  MetaComco has compilers
for sale for the ST and the sinclair QL (i think), and promises to have
one for the amiga RSN.  the price will be around $150.  (look for their
ads in Byte, etc).

> 3. Where do you find some reference material on BCPL, since it's not one of
> the current "in" languages?

    look for "BCPL The language and its Compiler", by Martin Richards
and Colin Whitby-Strevens, Cambridge University Press, LC#77-91098,
ISBN#0-521-28681-6.  i got my copy in 1982, so it's not quite ancient
history yet.

    now that i've said all that, you can probably just forget most of it.
BCPL doesn't provide any compelling advantage over C and assembler, so
there's not much reason to want to write programs with it.  buying the
book might be a good idea, if you're interested in hacking on the internals
of AmigaDos.

	wayne hamilton
	U of Il and US Army Corps of Engineers CERL
UUCP:	{ihnp4,pur-ee,convex}!uiucdcs!uiucuxc!hamilton
ARPA:	hamilton%uiucuxc@a.cs.uiuc.edu	USMail:	Box 476, Urbana, IL 61801
CSNET:	hamilton%uiucuxc@uiuc.csnet	Phone:	(217)333-8703
CIS:    [73047,544]			PLink: w hamilton

mwm@eris.BERKELEY.EDU (Mike (Don't have strength to leave) Meyer) (10/29/86)

[Does ++c == p or d?]

In article <148600179@uiucuxc> hamilton@uiucuxc.CSO.UIUC.EDU writes:
>    look for "BCPL The language and its Compiler", by Martin Richards
>and Colin Whitby-Strevens, Cambridge University Press, LC#77-91098,
>ISBN#0-521-28681-6.

Yup. But:

>    AmigaDos was written by MetaComco, a british software house.  BCPL was
>developed in britain (the "c" stands for "Cambridge").  BCPL isn't the worst
>language i've ever seen; i'd prefer it to Cobol or Basic or Pascal.

From the reference given above, page 1, paragraph 1, sentence 1:

	The language BCPL (Basic CPL) was originally developed as a
	compiler-writing tool and, as it's name suggests, is closely
	related to CPL (Combined Programming Language) which was
	jointly developed at Cambridge and London Universities.

Of course, BCPL could be an acronym for many things (like BASIC or
SNOBOL), so I'll apologize in advance if you've got a quote where it
is used that way.

	<mike

hadeishi@husc4.harvard.edu (mitsuharu hadeishi) (10/29/86)

In <148600179@uiucuxc> Wayne Hamilton writes:
>    now that i've said all that, you can probably just forget most of it.
>BCPL doesn't provide any compelling advantage over C and assembler, so
>there's not much reason to want to write programs with it.  buying the
>book might be a good idea, if you're interested in hacking on the internals
>of AmigaDos.

	Yes, if you want to write an AmigaDOS device driver (not
just an Exec device but an AmigaDOS device) you have to write the
interface code in either BCPL or Assembler that looks like BCPL.
Either way you have to learn about BCPL and its calling conventions,
etc.  So, for example, if someone wanted to write an AmigaDOS device
driver for the clipboard.device (HINT HINT) you would need to write
the glue code in BCPL so you could access it through the filesystem
(i.e., as in fopen("CLP:","r");) in the same manner as a regular file.
This, of course, is a VERY useful thing to do, since almost all programs
access files and so on through AmigaDOS devices rather than directly
through Exec.  (It is unfortunate that we have two levels of devices,
and that you cannot write AmigaDOS drivers in a completely compatible
fashion in C.  This is the design legacy of Tripos.)

				-Mitsu


	wayne hamilton
	U of Il and US Army Corps of Engineers CERL
UUCP:	{ihnp4,pur-ee,convex}!uiucdcs!uiucuxc!hamilton
ARPA:	hamilton%uiucuxc@a.cs.uiuc.edu	USMail:	Box 476, Urbana, IL 61801
CSNET:	hamilton%uiucuxc@uiuc.csnet	Phone:	(217)333-8703
CIS:    [73047,544]			PLink: w hamilton

andy@amiga.UUCP (Andy Finkel) (10/29/86)

In article <148600179@uiucuxc> hamilton@uiucuxc.CSO.UIUC.EDU writes:
>
>> 2. How does one go about programming in BCPL on the Amiga.
>> If it is with some stuff the developers got, but we ordinary users don't
>> have access to, is there any plan to make a BCPL programming package
>> available to the general user?
>
>    all the developers i know did _not_ get a BCPL compiler.  i'm not even
>sure the folks at c-a have one for use in-house.  MetaComco has compilers
>for sale for the ST and the sinclair QL (i think), and promises to have
>one for the amiga RSN.  the price will be around $150.  (look for their
>ads in Byte, etc).
>

Actually, we do have a BCPL compiler which runs on the Sun.  We use
it to maintain AmigaDos.  (Let's stop this rumor before it snowballs...
we have all the source to the entire Amiga system, and can remake
it without sending to England !)

>	wayne hamilton

			andy finkel


-- 

			andy finkel
			Commodore(Amiga)
			{ihnp4|seismo|allegra}!cbmvax!andy
		or	 pyramid!amiga!andy

Any expressed opinions are mine; but feel free to share.

I disclaim all responsibilities, all shapes, all sizes, all colors.

"Remember, no matter where you grow, there you are." - Buckaroo Bonsai.

phillip@cbmvax.cbm.UUCP (Phillip Lindsay) (10/29/86)

> Summary: There is one use for BCPL on the Amiga
> 
> In <148600179@uiucuxc> Wayne Hamilton writes:
>>    now that i've said all that, you can probably just forget most of it.
>>BCPL doesn't provide any compelling advantage over C and assembler, so
>>there's not much reason to want to write programs with it.  buying the
>>book might be a good idea, if you're interested in hacking on the internals
>>of AmigaDos.
> 
> 	Yes, if you want to write an AmigaDOS device driver (not
> just an Exec device but an AmigaDOS device) you have to write the
> interface code in either BCPL or Assembler that looks like BCPL.
> Either way you have to learn about BCPL and its calling conventions,
> etc.  So, for example, if someone wanted to write an AmigaDOS device
> driver for the clipboard.device (HINT HINT) you would need to write
> the glue code in BCPL so you could access it through the filesystem
> (i.e., as in fopen("CLP:","r");) in the same manner as a regular file.
> This, of course, is a VERY useful thing to do, since almost all programs
> access files and so on through AmigaDOS devices rather than directly
> through Exec.  (It is unfortunate that we have two levels of devices,
> and that you cannot write AmigaDOS drivers in a completely compatible
> fashion in C.  This is the design legacy of Tripos.)
> 
> 				-Mitsu
> 
> 
> 	wayne hamilton
> 	U of Il and US Army Corps of Engineers CERL
> UUCP:	{ihnp4,pur-ee,convex}!uiucdcs!uiucuxc!hamilton
> ARPA:	hamilton%uiucuxc@a.cs.uiuc.edu	USMail:	Box 476, Urbana, IL 61801
> CSNET:	hamilton%uiucuxc@uiuc.csnet	Phone:	(217)333-8703
> CIS:    [73047,544]			PLink: w hamilton

I think you better look at an earlier posting I made "my-handler". A
AmigaDos handler written *totally* in C. Under release 1.2 you can specify
a GlobVec of -1 in the device node and when AmigaDos loads (creates) you he
won't try and start you up like a BCPL program... BTW, the initial packet is 
sent to you...you don't find it in D1. (if your GlobVec == -1 ) 

-phil

==============================================================================
  Phillip Lindsay - Commodore Business Machines - Amiga Technical Support
    Dirt: 1200 Wilson Drive, West Chester  PA 19380                
    uucp: {ihnp4|seismo|caip}!cbmvax!phillip
    arpa: cbmvax!phillip@seismo -or- phillip@cbmvax.UUCP@{seismo | harvard}
    Tel.: (215) 431-9180
Disclaimer: [someone said I needed this] No warranty is implied or otherwise
   given in the form of suggestion or example. Any opinions found here are of
   my making. [unless Fred pops up (my other self)] 
==============================================================================

hamilton@uiucuxc.CSO.UIUC.EDU (11/01/86)

mwm@eris says:

> >the "c" [in "BCPL"] stands for "Cambridge".
> 
> From the reference given above, page 1, paragraph 1, sentence 1:
> 
> 	The language BCPL (Basic CPL) was originally developed as a
> 	compiler-writing tool and, as it's name suggests, is closely
> 	related to CPL (Combined Programming Language) which was
> 	jointly developed at Cambridge and London Universities.

[pardon me while i kick myself].
you're right.  my brain must've been idling when i wrote that.
	wayne