Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!wanginst!ulowell!ci-dandelion!talcott!husc6!harvard!cmcl2!seismo!rochester!kodak!ektools!bruce From: bruce@ektools.UUCP (Bruce D. Nelson ) Newsgroups: net.micro.atari8 Subject: Re: From which drive did I start (Atari-800)? Message-ID: <388@ektools.UUCP> Date: Fri, 2-May-86 08:40:53 EDT Article-I.D.: ektools.388 Posted: Fri May 2 08:40:53 1986 Date-Received: Tue, 6-May-86 06:45:00 EDT References: <8604230049.AA04104@ucbvax.berkeley.edu> Reply-To: bruce@ektools.UUCP (Bruce D. Nelson (408)) Organization: Eastman Kodak, Dept. 47 Lines: 26 In article <8604230049.AA04104@ucbvax.berkeley.edu> rgenter@BBN-LABS-B.ARPA (Rick Genter) writes: > Is there some way, from Basic, to determine from which disk drive the >currently executing program was started? Obviously if the program was just >typed in this should return a indication. But if I typed: > > RUN "D3:FOO.BAS > >is there something that FOO.BAS can do to determine that it was executed from >D3: as opposed to D:? As this is Basic, no hack, no matter >how gross or disgusting, will be frowned upon, as long as it works :-). BASIC uses IOCB #7 to do all its internal I/O (LOAD, RUN, SAVE, LPRINT, etc.). Therefore, if you do a PEEK(195) which is the ICDNO of IOCB #7 you will get an integer which is the unit number of the device last accessed (although the IOCB is closed by then). Make sure you do no other channel 7 I/O before you do the PEEK(195). If you do a PEEK(195) after an LPRINT, you get a 1, which is the unit number of "P1:". If you do a PEEK(195) right after you did a LOAD "D6:FOO", you will get a 6. Try it - it really works! Bruce D. Nelson {...}!rochester!kodak!ektools!bruce C-Serve: 70175,672 Delphi: BRUCENELSON BBS: (716)334-8232 SUNDAYS ONLY 9am-9pm EDT