Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!husc6!husc4!waldman From: waldman@husc4.HARVARD.EDU (benjamin waldman) Newsgroups: comp.sys.mac Subject: Re: How to launch an application Message-ID: <1828@husc6.UUCP> Date: Sat, 2-May-87 14:01:52 EDT Article-I.D.: husc6.1828 Posted: Sat May 2 14:01:52 1987 Date-Received: Sun, 3-May-87 06:20:09 EDT References: <1405@uwmacc.UUCP> <3326@linus.UUCP> Sender: news@husc6.UUCP Reply-To: waldman@husc4.UUCP (benjamin waldman) Followup-To: <1405@uwmacc.UUCP> <3326@linus.UUCP> Distribution: world Organization: Harvard Univ. Science Center Lines: 36 Keywords: launch In posting 1405, someone asked how to start an application from assembly language. I mailed him an answer directly, but since the same question has been asked again, I'll post a response. Basically, there are two ways to start an application. You can use the _Launch trap ($A9F2, I think), or the _Chain trap. Both start a new application, but while _Launch clears the application heap, _Chain does not, enabling one application to pass information to a second. The Finder uses _Launch. Before you use either of these traps, the following must be set up. (A0) should be a pointer to the name of the new application, a Pascal string, I presume. The value in 4(A0) determines which screen and sound buffers are used. A 0 means use the main screen and sound buffers, any positive value means use the alternate sound and main screen buffers, and any negative value means use the alternate screen and alternate sound buffer. For the sake of compatibility, only the main screen and sound buffers should be used, since not all Macs have the alternate buffers (I think that this is what got Megaroids into trouble). Anyway, I think that this piece of code will serve as a demonstration. I haven't used it or tested it, but I think it should work. String_Format 3 (make sure that strings are Pascal strings) buffer: ds.l 2 name: dc.b "My application" lea buffer(A5),A0 lea name,A1 move.l A1,(A0) clr.l 4(A0) _Launch I hope this is helpful. Benjamin Waldman waldman@husc4.harvard.edu