rgenter@BBN-LABS-B.ARPA (Rick Genter) (04/22/86)
I recently unpacked my Atari-800 which has been in storage for the past two years and have been doing some extensive Basic hacking on it. I have a question that I can't find the answer to in any of my documentation, though I may have just missed it. 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 <No such drive> 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<anything else>:? As this is Basic, no hack, no matter how gross or disgusting, will be frowned upon, as long as it works :-). Please reply directly to me; I have asked to be on this mailing list, but have not gotten it confirmed yet and don't want to miss any responses. I'll summarize when appropriate. -------- Rick Genter BBN Laboratories Inc. (617) 497-3848 10 Moulton St. 6/506 rgenter@labs-b.bbn.COM (Internet new) Cambridge, MA 02238 rgenter@bbn-labs-b.ARPA (Internet old) ...!{decvax,linus}!bbncca!rgenter (UUCP)
bruce@ektools.UUCP (Bruce D. Nelson ) (05/02/86)
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 <No such drive> 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<anything else>:? 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