0 Members and 1 Guest are viewing this topic.
10 open2,8,0,"$"20 get#2,a$:get#2,a$:rem load adrs30 if(st and 64)thenclose2:end:rem err40 do:get#2,a$:get#2,a$:rem line link50 get#2,a$:x=asc(a$):get#2,a$:x=x+256*asc(a$):printx;:rem size60 do:get#2,a$:printa$;:a=asc(a$):loopuntila=34ora=0:rem get leading space70 ifa=0thenprint:exit:rem blocks free80 n$="":do:get#2,a$:ifasc(a$)=34thenexit90 n$=n$+a$:loop:rem build filename100 printn$;a$;:rem show name+end quote110 do:get#2,a$:ifasc(a$)=0thenexit120 printa$;:loop:rem file type130 print:loop140 close2
Wow, can't believe you couldn't find it. Try this. Code: [Select]10 open2,8,0,"$"20 get#2,a$:get#2,a$:rem load adrs30 if(st and 64)thenclose2:end:rem err40 do:get#2,a$:get#2,a$:rem line link50 get#2,a$:x=asc(a$):get#2,a$:x=x+256*asc(a$):printx;:rem size60 do:get#2,a$:printa$;:a=asc(a$):loopuntila=34ora=0:rem get leading space70 ifa=0thenprint:exit:rem blocks free80 n$="":do:get#2,a$:ifasc(a$)=34thenexit90 n$=n$+a$:loop:rem build filename100 printn$;a$;:rem show name+end quote110 do:get#2,a$:ifasc(a$)=0thenexit120 printa$;:loop:rem file type130 print:loop140 close2Lines 80,90 build the filename. On line 100 you could assign the name to an array instead of printing it on screen; maybe F$(I)=N$:I=I+1. If you do that, note the first "filename" would really be the name of the disk and you need to DIM F$ unless you know the disk has 9 or less files. The only problem is some directories put a quote in the filename (to escape from quote mode) so they can print special characters like CLR_SCRN. That will ruin N$. The only way I know to get around that is to open directory as normal file (OPEN 2,8,2,"$") but then the structure is quite different so would need a different program.
where on God's-Green-Earth did you dig that routine up?? ... the archives on this forum?...thank you
Quote from: stiggitywhere on God's-Green-Earth did you dig that routine up?? ... the archives on this forum?...thank youI wrote in a few minutes. Not that I'm normally that quick, I "dug it up" mostly from memory. Hopefully it is general and simple enough to be instructive, and easily found...You're welcome, Merry Christmas! @BDD:I think stiggity is trying to work this into assembly, according some other posts he's made. Good point about string arrays on the C64. On the C128 it is not as bad, but can still cause problems... the C128 will freeze for *only* a dozen seconds, as opposed to a dozen minutes on C64.