🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #6599

Re: THOSE DAMNED BPTR'S

#6599
From: geoff c wing
Date: Mon, 12 Nov 1990 13:16
36 lines
2231 bytes
In <18556@ultima.socs.uts.edu.au> mark.newton@f805.n680.fido.oz.au (Mark Newton) writes:
>I want to write a function that does something like Execute() or system(),
>partly as a learning experience, but mostly to give a bit more flexability than
>those two functions.
> 
>I was under the impression that I could use LoadSeg() to load the code for the
>new process, initialize a (struct Process) so that it's pr_SegList was pointing
>to the LoadSeg()'ed code, set the initial PC to the start of the code and call
>CreateProc().  Ok so far? Ok.
> 
>LoadSeg() returns a long, and the pr_SegList is a BPTR.  I haven't got the
>autodocs (I have got 1.3 Libraries and Devices), but I assume that the return
>address from LoadSeg() is the starting address in memory of the segment.  How
>can I convert this to a BPTR?
> 
>Thanx muchly,
>    -mark
>--- TBBS v2.1/NM
> * Origin: ADAM, 2,100 MEGS R/W 32 line TBBS call us 08-370-5775 (680/805)

LoadSeg returns a BCPL pointer(BPTR) to the first segment. Now you can just
call CreateProc with the appropriate information, which will run the program 
under a NEW process it has just initialized. You don't have to go to the effort
of initializing that process yourself, but you can, of course, change it after
it's started.
BTW, CreateProc returns a BCPL pointer to the MsgPort of the process data 
structure. You should get "Advanced System Programmer's Guide for the Amiga" 
(book 7) by Abacus. It documents calls to the standard libraries.

BPTR : actual address divided by four 
BSTR : byte containing length of string followed by actual string
-- 
	+---------------------------------+       _  _ _ _  __
	|	     Geoff		//|   /\  |\/|  |  / _   /\
	| static@phoenix.pub.uu.oz.au \X/ |  //\\ |  | _|_ \__| //\\
	+---------------------------------+
Technical Details
Message-ID: <1990Nov12.131651.5394@phoenix.pub.uu.oz.au>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!munnari.oz.au!labtam!eyrie!phoenix!static
References: <18556@ultima.socs.uts.edu.au>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!munnari.oz.au!labtam!eyrie!phoenix!static
From: static@phoenix.pub.uu.oz.au (geoff c wing)
Newsgroups: comp.sys.amiga.tech
Subject: Re: THOSE DAMNED BPTR'S
Message-ID: <1990Nov12.131651.5394@phoenix.pub.uu.oz.au>
Date: 12 Nov 90 13:16:51 GMT
References: <18556@ultima.socs.uts.edu.au>
Organization: Phoenix ComSystem.
Lines: 36