Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!oddjob!mimsy!umd5!hans From: hans@umd5.umd.edu (Hans Breitenlohner) Newsgroups: comp.sys.atari.8bit Subject: Re: What's the right way... Message-ID: <2005@umd5.umd.edu> Date: Thu, 22-Oct-87 15:30:50 EST Article-I.D.: umd5.2005 Posted: Thu Oct 22 15:30:50 1987 Date-Received: Sun, 25-Oct-87 08:51:18 EST References: <871006122252.4.JRD@GRACKLE.SCRC.Symbolics.COM> Reply-To: hans@umd5 (Hans Breitenlohner) Organization: University of Maryland, College Park Lines: 28 In article <871006122252.4.JRD@GRACKLE.SCRC.Symbolics.COM> jrd@STONY-BROOK.SCRC.SYMBOLICS.COM (John R. Dunning) writes: >What's the right way >to return from a program to DOS? I always thought the protocol was that >DOS (any DOS) effectively JSR'ed to the start address of the program >once it was loaded; thus the right way to return was just to RTS. >That's always worked for me, using DOS XL. However, I've gotten some >reports that Kermit-65 sometimes wedges up when one exits from it. I'm >pretty sure I'm not trashing the stack; it really looks like DOS expects >something other than an RTS. > While your way should work usually, here is a different way. This is what Turbo-Basic does before returning to DOS: 1. Clear locations $D200-$D207 (audio registers) 2. Close IOCBs 1-7 3. Jump indirect through DOSVEC ($000A). If you have done interesting things with the screen, it might be even better to refine step 2: 2a: Close all IOCBs. 2b: Open IOCB 0 for screen editor. Of course you can skip step 1 if you have not done anything with the audio registers, and it may be that DOS (some DOS) will do the equivalent of steps 2a and 2b after you return.