[comp.sys.amiga] How RESIDENT segments work & note to Scott Turner

bryce@COGSCI.BERKELEY.EDU.UUCP (06/07/87)

>"magic"

HOW RESIDENT SEGMENTS WORK.  (Reproduced without permission from AmigaMail (tm))
(AmigaMail is a "technical support publication from Commodore-Amiga inc."  It's
usually full of all sorts of goodies and can be yours for one year by sending
$20 to Laureen Brown/Amiga Mail 1200 Wilson Drive, West Chester, PA 19380)


The resident segment list is held as a BPTR in the DosInfo substructure.
(Dosbase to dl_Root then to rn_Info and eventually to di_NetHand)
If di_NetHand is =0 forget it.  If not each entry looks like this:

		BPTR NextEntry	;(Batty-PoinTeR to next list entry)
		LONG UseCount	;Number of times in use, or -1 if unloadable)
		BPTR SegPtr	;Segment Batty-PointTeR
		BSTR SegName	;Name of Segment

The SegPtr points to a loaded segment list.   This is an unmolested, normal
seglist and therefore the code:

         -> MUST be fully re-entrant.<-

No BSS hunks, no self modifying code.  If you use varriables, allocate space on
the stack or with AllocMem -> none of your segments, even DATA segments, may
be modified by your program.
BCPL programs qualify, as do most 68000 programs.  C programs usually do not,
especially if they use Astartup.obj or Lstartup.obj.


>-----------
> I seem to have this note buried in my mind that we agreed NOT to re-distribute
> items sent to us under the 1.2 beta test. Of course my memory could be playing
> tricks with me...

So one would have expected.  If it HAD come my way I would have agreed to it.
Even though it did not, I have respeceted that position.


>----------
>>"cli-resident"
>>(Scott, break out the MCC dissassembler...)
>Aye aye Capt'n! ;-) You want a new cli-resident or just the "magic"? 

I want the ability to write a shell that starts with all the abilities of
the standard CLI.  This means that ability to Exec() BCPL programs cleanly.
Sadly, this probably means calling some BCPL globals, but as long as BCPL
programs must be supported, the ability is needed.  Use of the non-supported
BCPL junk will not go byond the minimum needed to write a working CLI.

In short -> a new cli-resident that can be learned from.  68000 source code 
would be perfect.



BTW: That issue of AmigaMail also has info on Path Lists, the expaned DevInfo
structure for devices, printer drivers etc.  I already posted it's information
on the new packets (SET_DATE, SCREEN_MODE, FLUSH, MORE_CACHE, and DISK_INFO)
-------------
         Ack!  (NAK,EOT,SOH)
 |\ /|  .
 {o O} .  bryce@cogsci.berkeley.EDU -or- ucbvax!cogsci!bryce
 ( " )    SEGMENTS ARE FOR WORMS  -Neil Katin
   U      ban the BPTR!  (BSTRs are ok)