[comp.sys.amiga.tech] Need help with Amiga Tasks

ccplumb@lion.waterloo.edu (Colin Plumb) (04/10/90)

One slightly annoying thing about AmigaDOS is that to make dos.library
calls you need to be more than a task.  You need to be a process, where

atruct Process {
	struct	Task	pr_Task;
	struct	MsgPort	pr_MsgPort;
	WORD	pr_Pad;
	BPTR	pr_SegList;
	LONG	pr_StackSize;
	APTR	pr_GlobVec;
	LONG	pr_TaskNum;
	BPTR	pr_StackBase;
	LONG	pr_Result2;
	BPTR	pr_CurrentDir;
	BPTR	pr_CIS;
	BPTR	pr_COS;
	APTR	pr_ConsoleTask;
	APTR	pr_FileSystemTask;
	BPTR	pr_CLI;
	APTR	pr_ReturnAddr;
	APTR	pr_PktWait;
	APTR	pr_WindowPtr;
};

The important things are pr_CIS and pr_COS, the current input and output
streams, and pr_MsgPort, which is the MsgPort used by file system
requests.  If these don't exist after your task structure, dos.library
will use them anyway, resulting in a rapid guru.

To get your code to work, you either have to make a process structure
(icky; cloning your parent's is probably easiest), or access the
console.device directly.  I believe it's currently bombing because
the print routines you're using call the dos.library eventually.

Sorry about the messiness.
-- 
	-Colin