"list" command

Basic and Machine Language

Moderator: Moderators

Post Reply
JoshuaHorn
Vic 20 Drifter
Posts: 37
Joined: Fri Feb 06, 2009 11:03 am

"list" command

Post by JoshuaHorn »

Hey all,

I need some help. I need to figure out how to "list" the directory of a floppy disk within a basic program line.

If you try to use load "$",8 it gives you an error if run from within a program.

Any ideas?

(This is for NasOS, so I'm writing something like:)

IF I$ = "DIR" THEN....
Joshua Horn
--
"Just because YOU think it's old, does not me it's useless to ME!" -- Joshua Horn
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: "list" command

Post by Mike »

JoshuaHorn wrote:If you try to use load "$",8 it gives you an error if run from within a program ...
No wonders. This command loads the directory as a program as well, which will overwrite your current program in memory.

This small program displays the directory, and can easily be turned into a sub-routine called from your IF statement:

Code: Select all

1 OPEN2,8,0,"$":Z$=CHR$(0):GET#2,A$,B$:GOSUB3:PRINT
2 GOSUB3:GET#2,A$,B$:PRINTA$B$:ON-(ST=0)GOTO2:CLOSE2:END
3 GET#2,A$,B$,C$,D$:PRINTMID$(STR$(256*ASC(D$+Z$)+ASC(C$+Z$)),2)" ";
4 FORT=1TO2:GET#2,A$,B$,C$,D$,E$,F$,G$,H$,I$,J$,K$,L$,M$
5 PRINTA$B$C$D$E$F$G$H$I$J$K$L$M$;:NEXT:RETURN
Greetings,

Michael
Post Reply