home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / BASIC / BAS_SUB.ZIP / DIR4.BAS < prev    next >
Encoding:
BASIC Source File  |  1985-04-19  |  2.3 KB  |  44 lines

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