[comp.sys.amiga] Help creating a Task; CreateTask

miner@ulowell.UUCP (Richard Miner) (12/07/86)

Does anyone have a working example that starts up a child task under 1.2?
I have put some effort into getting a task to spawn over the past few 
evenings with little success.  The examples in the RKM, both original 
V1.0 and the newer releases do not work.  The V1.0 example is full of 
bugs like incorrect address modes for structures etc, and the newer 
manual has an erronious and incomplete example.  I have tried to
correct the problems with both of these but still no luck.

I have tried using both CreateTask() and AddTask() (doing the extra work
for AddTask).   I have only tried with Manx under Beta3.03e under 1.2 but
would like to think this is not causing the problem,  though I will probably
try latice soon to see if it is a bug with the beta manx.  I have also tried
some examples from the Fish disks which include a tutorial on tasks, and 
that example also will not work :-( .   One thing that scares me is that
in the archived manx library the parameters to CreateTask are different
types then what they should be, like priority is defined as a long instead
of a BYTE. I have tried correcting this, also no luck.

I am going to try the example by Bob Peck that was published in the May
'86 Developers news letter.  He seems to take a little different approach 
then the other examples, he does more work to set up a FakeMemList not
just an allocated chunk of mem for a stack.  In the meantime I though
I would send this ALERT to the net in the event that program fails.

I have been  through lots of examples and set up my Task structure by the 
book. I call AddTask with this structure and the pointer to the function I 
want to start as a task.  Question can the tc_SPLower, tc_SPUpper, and 
tc_SPReg pointers of the Task struct just point into the proper locations of a 
chunk of mem that I alloc using AllocMem(STACKSIZE, MEMF_PUBLIC | MEMF_CLEAR)?
This is how most of the example I have seen do it, including CreateProc, but
then why does Bob Peck create the FakeMemList that I never saw in any other 
examples or doc?

I have used LoadSeg and CreateProc before with great success, but I do not
need to have a process and would rather keep these modules executing in exec 
away from that beast AmigaDos.

If it will help I could post a little code that demos me problems.  If, 
however, in the next few evenings I solve my problem or one of the gang
at Tech Support or another netter help me out I would rather post some
working source! 

Rich Miner     ...!wanginst!ulowell!miner    
University of Lowell, Comp Sci Dept  (617) 452-5000 x2693
HAL hears the Amiga9000 series is not selling. "Please explain Dave. Why 
aren't HAL's selling?"  Bowman hesitates. "You aren't IBM compatible."

chiu@princeton.UUCP (Kenneth Chiu) (12/09/86)

In article <831@ulowell.UUCP> miner@ulowell.UUCP (Richard Miner) writes:
> Does anyone have a working example that starts up a child task under 1.2?
> . . .I have only tried with Manx under Beta3.03e under 1.2. . .

This may be obvious, but are you using small code/data?  Then I think you need
to make sure a4 points to the middle of your data space.  Read the manual
carefully for details.  I've created tasks with 1.1 and 3.20a, but not 1.2.


While I'm on the subject, is there an easy way to run a program without the
overhead of a process?  If you copy the task into allocated memory, then you
must use only relative addressing, or do some major address translations.
At any rate it is a pain.  What would be ideal is a compiler directive that
lets you prevent deallocation of this function upon exit.
-- 
Kenneth Chiu                                              UUCP: princeton!chiu
Princeton University Computer Science Department        BITNET: 6031801@PUCC