Jump to content
IGNORED

Basic command for disk directory?


griff3125

Recommended Posts

Have to wonder - how compact could an assembly version be made, like to sit near the bottom of Page 1.

So then you could have something like ? USR(270)

 

Or theoretically a stub could live in some free RAM down low with the directory program under the OS - done as an AUTORUN.SYS

Link to comment
Share on other sites

12 hours ago, Rybags said:

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.

After RUN or GOTO 32000 I get STOPPED  AT LINE 32100

Link to comment
Share on other sites

as in change 

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

 

to

 

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

 

the error was

 

Error-131 IOCB write only.

Before you can do anything with a peripheral, you must first OPEN a channel (IOCB) to it. The OPEN command will specify whether data is to be read from or sent to the device. (This is of course done automatically with certain BASIC commands such as SAVE, LOAD, LPRINT etc.) If you OPEN a device to send data to it and then try to read data from it, this error results. You will then have to CLOSE the channel, and reOPEN it for read or read write (update).

 

you have to RUN fresh or GOTO 32000 to OPEN the device and of course you see the fix up in the line # so it keeps pulling Dir data until no more info.

 

http://www.page6.org/archive/issue_22/page_10.htm

more error codes at

http://www.page6.org/archive/issue_21/page_24.htm

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

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

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.

 

 

18 hours ago, Philsan said:

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

 

Done!

 

Place this file on disk and just type "ENTER D:DIR".

DIR

 

Why didn't you explain me that solution 36 years ago? ?

 

  • Haha 1
Link to comment
Share on other sites

21 hours ago, Philsan said:

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

Sure, here you go:


10 OPEN #1,8,0,"D:DIR"
20 DIM Q$(1):Q$=CHR$(34)
30 PRINT #1;"CLR:DIM D$(32):CL.#1:";
40 PRINT #1;"O.#1,6,0,";Q$;"D:*.*";Q$;
50 PRINT #1;":FORI=0TO0STEP0:";
60 PRINT #1;"I.#1,D$:?D$:";
70 PRINT #1;"I=I+(D$(2,2)<>";Q$;" ";Q$;")";
80 PRINT #1;":NEXTI:CL.#1:CLR"
90 CLOSE #1

It actually also fixes the issue of #1 not being closed properly at the end. Enter this, save as "D:DIR.BAS", run it, and it creates "D:DIR". ENTER "D:DIR" does the job.

 

  • Like 1
Link to comment
Share on other sites

13 hours ago, Philsan said:

 

 

Done!

 

Place this file on disk and just type "ENTER D:DIR".

DIR 93 B · 3 downloads

 

Why didn't you explain me that solution 36 years ago? ?

 

 

Well,

 

this DIR command was available as a type-in listing in various german magazines in the 80s. You should have read more german Atari magazines back then... ;-)  e.g.:

 

- HC - Mein HomeComputer (Vogel Verlag), 02/1984 by Thomas Tausend, maybe it was also part of "Die Hexenkueche" (a Basic utility collection) by Thomas Tausend

- or Computronic, 4/1986 "Directory in Basic" by Oliver Cyranka

 

The attached HC ATR image contains the listing, use RUN"D:DIRECTOR.BAS" to load the file, it will generate a file on diskette, use ENTER"D:DIR" to enter that file and therefore execute a directory command; the attached CT ATR image also contains a basic listing, use RUN"D:DIR.BAS" to generate the file...

 

HC_Mein_Home-Computer_1984_side_a.zip

Computronic_1986_(side_b).zip

  • Haha 1
Link to comment
Share on other sites

So, here are the three programs that create the file that can be used with ENTER"D:DIR" to show directory.

The results are the same, apart the fact the third program displays name-size bar.

Which is better and what are the differences from a programmer's points of view?

 

THORFDBG

10 OPEN #1,8,0,"D:DIR"
20 DIM Q$(1):Q$=CHR$(34)
30 PRINT #1;"CLR:DIM D$(32):CL.#1:";
40 PRINT #1;"O.#1,6,0,";Q$;"D:*.*";Q$;
50 PRINT #1;":FORI=0TO0STEP0:";
60 PRINT #1;"I.#1,D$:?D$:";
70 PRINT #1;"I=I+(D$(2,2)<>";Q$;" ";Q$;")";
80 PRINT #1;":NEXTI:CL.#1:CLR"
90 CLOSE #1
HC MEIN COMPUTER 02/1984

1 DIM M$(120)
2 M$="CLR:DIMQ$(20):CL.#1:O.#1,6,0,'D:*.*':FOR N=1TO25STEP0:I.#1;Q$:?Q$:IFLEN(Q$)>10 AND Q$(5,8)<>'FREE' THEN N.N"
3 OPEN #1,8,0,"D:DIR"
4 FOR N=1 TO LEN(M$)
5 Z=ASC(M$(N,N))
6 IF Z=39 THEN Z=34
7 PUT #1,Z
8 NEXT N
9 PUT #1,155:END
COMPUTRONIC 1986

30 DIM M$(200)
40 M$="CLR:DIM A$(20):? '{CLR}  NAME         SIZE':? :CLOSE #1:OPEN #1,6,0,'D:*.*':FOR A=1 TO 70:INPUT #1,A$:? A$:"50 M$(103)="IF A$ (1,1)=' ' OR A$(1,1)='*' THEN NEXT A"
60 OPEN #1,8,0,"D:DIR.LST":FOR N=1 TO LEN(M$):C=ASC(M$(N,N)):IF C=39 THEN C=34
70 PUT #1,C:NEXT N:PUT #1,155
80 CLOSE #1

 

Link to comment
Share on other sites

The best option IMO is something that causes minimal disturbance to what you're doing which would likely be typing in or modifying a Basic program.

So, if it's creating new variables or inadvertantly trashing existing ones, not really good.

 

The ones I did earlier - not the most speedy things and the immediate mode one gives the error 136.   But minimalistic insofar as not using lots of variables and IOCBs.

  • Like 3
Link to comment
Share on other sites

  • 2 years later...

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...