home *** CD-ROM | disk | FTP | other *** search
- 10 ' ******* DIR4.BAS *******
- 20 ' 8-31-84 by Thomas E. Link
- 30 ' to demonstrate DIR4.ASM
- 40 ' *************************
- 50 '
- 60 DIM DIRLST$(111),DIRLST%(222),DIRDAT%(111),DIRTIM%(111),A%(305)
- 70 ' we dimension above arrays to hold as many as 111 directory entries
- 100 LOOK$=STRING$(40,32)
- 110 VOLUME$=STRING$(12,32)
- 130 DEF SEG: BLOAD"dir4.bin",VARPTR(A%(0))
- 140 DIM COMPILED%(1): COMPILED%(1)=1: ERASE COMPILED%
- 150 LSET LOOK$="A:*.*"+CHR$(0) ' default value for search
- 155 ' LOOK$ must terminate with CHR$(0) for DOS 2.x
- 160 LSET VOLUME$="*" ' we use this to see if there is a label later
- 170 COUNT%=0: DIRLST!=0
- 180 FOR X=0 TO 111: DIRLST$(X)=STRING$(12,32): NEXT ' clear the name array
- 190 INPUT "input file specifier OR <enter> ",I$ ' do we override default
- 200 IF LEN(I$)>3 THEN LSET LOOK$=I$+CHR$(0) ' whole name
- 210 IF LEN(I$)=2 AND RIGHT$(I$,1)=":" THEN LSET LOOK$=I$+"*.*"+CHR$(0) ' drive only
- 220 F%=VARPTR(A%(0))
- 230 IF NOT COMPILED%(1) THEN CALL F%(COMPILED%(1),LOOK$,DIRLST$(0),DIRLST%(0),DIRDAT%(0),DIRTIM%(0),VOLUME$,COUNT%)
- 235 IF COMPILED%(1) THEN CALL ABSOLUTE(COMPILED%(1),LOOK$,DIRLST$(0),DIRLST%(0),DIRDAT%(0),DIRTIM%(0),VOLUME$,COUNT%,F%)
- 240 '************** Now Print the list
- 250 IF INSTR(VOLUME$,"*") THEN 280
- 260 PRINT "Diskette is labeled: ";VOLUME$
- 270 '=========================================================================
- 280 FOR X=0 TO COUNT%-1 ' we have a record in element (0) so loop count-1
- 290 ' ***** print name
- 300 PRINT DIRLST$(X);
- 310 ' ***** print file length
- 315 DIRLEN!=(-(DIRLST%(X*2)<0)*(65536!)+DIRLST%(X*2))+(DIRLST%((X*2)+1)*65536!)
- 320 PRINT USING "######## ";DIRLEN!;
- 330 ' ***** print date
- 340 PRINT USING "##/";(DIRDAT%(X) AND 480)/32;(DIRDAT%(X) AND 31);:PRINT USING "## ";((DIRDAT%(X) AND (-511))/512)+80;
- 350 ' ***** print creation time
- 360 PRINT USING "##:";((INT(DIRTIM%(X) / 2048))AND 31);((DIRTIM%(X) AND 2016)/32);:PRINT USING "##";((DIRTIM%(X) AND 31)*2)
- 370 DIRLST!=DIRLST!+DIRLEN!
- 380 NEXT ' loop until done
- 390 PRINT: PRINT
- 400 PRINT DIRLST!;"bytes used in";COUNT%;"file";
- 410 IF COUNT%>1 OR COUNT%=0 THEN PRINT "s." ELSE PRINT "."
- 420 GOTO 150
- 430 ' this is the last line >>>>>>>>>>>>>>>>>>>>>>>