Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!van-bc!rsoft!mindlink!a464 From: a464@mindlink.UUCP (Bruce Dawson) Newsgroups: comp.sys.amiga.tech Subject: Re: Problem with CreateProc & LoadSeg Message-ID: <1677@mindlink.UUCP> Date: 5 May 90 04:15:20 GMT Organization: MIND LINK! - British Columbia, Canada Lines: 40 > root@dialog.sub.org writes: > > Msg-ID: <1856@dialog.sub.org> > Posted: 5 May 90 08:23:45 GMT > > Org. : Dialog Software Development > Person: Christian Motz > > Now for the "dirty" way, and my question how dirty this is, and > whether or not there is any cleaner way to do it. My problem was to > start a process much like Execute(), only asynchronously. As far as I > know, AmigaDOS knows no call for something like this. I know there are > things like ArpAsyncRun(), but I would like to do it on a " stock" > Amiga (besides: I wonder if ArpAsyncRun() is so clean itself). > > Now hold on to your seats, NetPeople, just in case this is the worst > programming practice you have ever seen -- feel free to flame me, but > only if you know of a better, "legitimate" solution. > > -- > Christian Motz root@dialog.sub.org Two of your debatable assumptions can easily be made solid. These are the assumption that CreateProc() will continue to return the address of the message port, and that A0 and D0 can continue to be set by poking into the stack. Both of these problems can be solved by doing a CreateProc on a short little assembler routine which will communicate with the main program. The assembler routine tells the main program where it's task structure is (easily found with FindTask(0L)) then it loads A0 and D0 (far far easier to load A0 and D0 of your own task than somebody elses) and then it does a JSR to the code that you actually want turned into a process. That still leaves the messiness of filling out pr_CIS and pr_COS, but at least two assumptions disappear. .Bruce. -- Bruce Dawson Day job: Distinctive Software Inc. Company name: CygnusSoft Software Work hard, rock hard, eat hard, sleep hard, grow big, wear glasses if you need 'em. Webb Wilder credo.