Jump to content
IGNORED

Basic command for disk directory?


griff3125

Recommended Posts

Running the standard Atari Basic cartridge, is there a simple command for getting a disk directory from the disk drive?

I have no issues loading or saving, but a listing of D1: would sure be convenient from the command level.

I can't believe I don't remember it and the myriad of books I have give no reference.

My gut feeling tells me Atari Basic omitted it?

Thanks for any input.

 

Link to comment
Share on other sites

You can input a number of basic commands to get a directory (a mini program if you will), or you can type DOS and get the directory from there. there are a number of add ons utilities and languages that add it as a straight up command as well. So there isn't a direct Atari BASIC A,B, or C command.

Edited by _The Doctor__
  • Like 1
Link to comment
Share on other sites

20 minutes ago, griff3125 said:

My gut feeling tells me Atari Basic omitted it?

You are correct.

 

There are a few utilities (whose names I cannot possibly recall after all these years) which patch extra commands into BASIC by intercepting the OS line editor, but the best long-term solution is to use Altirra BASIC or another interpreter which offers DIR and other useful immediate mode commands.

  • Like 4
Link to comment
Share on other sites

1 hour ago, griff3125 said:

Running the standard Atari Basic cartridge, is there a simple command for getting a disk directory from the disk drive?

Nope. I used to place a small program on every disk that printed the directory. It  is even possible to place there a couple of commands  in a text file, e.g. "D:DIR", and then list the directory by  ENTER "D:DIR".

 

The following text file may do:


CLR:DIMD$(20):CL.#1:O.#1,6,0,"D:*.*":FORI=0TO1STEP0:INPUT#1,D$:?D$:IF D$(2,2)=" " THEN NEXTI

Print this line to the file "D:DIR", and everytime you need the directory, "ENTER "D:DIR"" does the job, without erasing the current program.

 

  • Like 11
  • Thanks 1
Link to comment
Share on other sites

Typing in a program can be an annoyance since it's interfering with what you're doing.

 

A quick/dirty immediate mode method I used.  If you've already used it recently then type END or CLOSE #1 first:

 

O. #1,6,6,"D:*.*" : F. A=1 TO 9999 : GET #1,D : PUT #16,D : N. A

 

It'll output the dir until error 136 occurs for EOF.

Edited by Rybags
  • Like 3
  • Thanks 1
Link to comment
Share on other sites

16 hours ago, Rybags said:

Typing in a program can be an annoyance since it's interfering with what you're doing.

 

A quick/dirty immediate mode method I used.  If you've already used it recently then type END or CLOSE #1 first:

 

O. #1,6,6,"D:*.*" : F. A=1 TO 9999 : GET #1,D : PUT #16,D : N. A

 

It'll output the dir until error 136 occurs for EOF.

Good idea.  You could make this into a little program that you can ENTER.  This will create the program called "DIR.LST".  Which you can then use by:

 

ENTER "D:DIR.LST"

 

Anyway here it is:

 

10 OPEN #1,8,0,"D:DIR.LST"
20 ? #1;"CLOSE #1:O.#1,6,6,";CHR$(34);
"D:*.*";CHR$(34)
30 ? #1;"FOR A=1 TO 9999:GET #1,D:PUT
#16,D:NEXT A"
50 CLOSE #1

 

Link to comment
Share on other sites

10 minutes ago, flashjazzcat said:

This is exactly what was suggested in post #6 by thorfdbg, but without the line numbers (which are unnecessary). :)

Whoops I guess I missed that post.  The program I wrote just creates the "DIR.LST" program.  I guess I should have been more clear.

Edited by Gibstov
typos
Link to comment
Share on other sites

19 hours ago, Gavin1968 said:

No, that is what DOS is for. 

Well, actually, this is what *DUP* is good for. With the Atari DUP, it is just an annoyance that DUP needs to be loaded every time, and then if you have a program in memory, the FMS needs to create a MEM.SAV file... so it is not very practical with the original Atari Dos/Dup.

 

There were a couple of Basic extensions, like DiskIO (a version of which you find on the Atari++ page) where you could type "DIR" and you would get an (even sorted) output of the directory on the screen.

 

And then, again we have many basic dialects that have DIR. Turbo Basic, or Basic++ have it.

Link to comment
Share on other sites

On 4/1/2020 at 8:33 PM, thorfdbg said:

 


CLR:DIMD$(20):CL.#1:O.#1,6,0,"D:*.*":FORI=0TO1STEP0:INPUT#1,D$:?D$:IF D$(2,2)=" " THEN NEXTI

Print this line to the file "D:DIR", and everytime you need the directory, "ENTER "D:DIR"" does the job, without erasing the current program.

 

Could you please write the code to do it, I think OPEN and PRINT # something...

  • Confused 1
Link to comment
Share on other sites

On 4/1/2020 at 10:19 AM, skr said:

One BASIC program listing you the current directory would be this:

 


10 DIM A$(40)
20 TRAP 30:OPEN #1,6,0,"D1:*.*": GOTO 40
30 ? "ERROR ";PEEK(195):END
40 TRAP 70
50 INPUT #1,A$
60 ? A$:GOTO 50
70 END

Find the complete description there: https://www.atarimagazines.com/v8n6/QuickDirectory.html

I think we wrote a program just like this and called it "catalog.bas", mimicking the Apple IIe CATALOG command.  We would copy it to every basic disk we had.  Good times. 

Link to comment
Share on other sites

On the very day Turbo Basic was released in the German magazine "Happy Computer" as type in listing I started typing it in within a few hours and then barely used Atari Basic anymore.

So I was very used to the DIR command of TB. Before that I always typed DOS to get a directory, losing lots of listings, as I forgot to save them before jumping to DOS...

  • Like 4
Link to comment
Share on other sites

The problem using DIR.LST is you then need to put it on every disk you're likely to use.

 

An alternate could be to just embed it in your current Basic program.  Probably best to put it right near the end, and have it such that you can GOTO it in immediate mode and have it create minimal disturbance.

 

So it might be something like:

32000 CLOSE #5 : OPEN #5,6,0,"D:*.*" : TRAP 32100

32010 GET #5,ZZ : PUT #16,ZZ : GOTO 32020

32100 CLOSE #5 : STOP

 

STOP instead of END so that other IOCBs aren't closed and you can use GOTO to resume your program if you've hit Break somewhere.

  • Like 1
Link to comment
Share on other sites

12 hours ago, skr said:

So I was very used to the DIR command of TB. Before that I always typed DOS to get a directory, losing lots of listings, as I forgot to save them before jumping to DOS...

 

12 hours ago, skr said:

 

So I was very used to the DIR command of TB. Before that I always typed DOS to get a directory, losing lots of listings, as I forgot to save them before jumping to DOS...

I used DOS XL as I liked the command line better and it would also allow returning to BASIC without losing stuff. 

On 4/1/2020 at 8:33 PM, thorfdbg said:

 


CLR:DIMD$(20):CL.#1:O.#1,6,0,"D:*.*":FORI=0TO1STEP0:INPUT#1,D$:?D$:IF D$(2,2)=" " THEN NEXTI

 

Print this line to the file "D:DIR", and everytime you need the directory, "ENTER "D:DIR"" does the job, without erasing the current program.

 

That's truly a very elegant solution, @thorfdbg! I admire both your idea and Atari BASIC's design that allows it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...