home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol085 / pasdir.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1984-04-29  |  1.7 KB  |  71 lines

  1. Program PascalDirectory;
  2. {    Driver program to demonstrate procedure directory()
  3.  
  4.     All externals in Pascal/Z Users Group Library "ASL.REL"
  5.  
  6.     translated to Pascal/Z - 07/10/82 (rep)
  7.     added peek(), poke(), call(), and additional comments.
  8.  
  9.     original program by Daniel S. Hunt
  10.                 822 Green Valley
  11.                 Newbury Park, CA.  91320
  12.     as published in BYTE, June 1982, page 497
  13. }
  14.  
  15. type    byte = 0..255;
  16.     strng12 = packed array [1..12] of char;
  17.  
  18.  
  19. {   peek() returns the contents of the memory location given   }
  20. {   by address. the value returned is a single byte integer.   }
  21. function peek ( address: integer ): byte;
  22.     external;
  23.  
  24. {   poke() stores the low-order eight bits of abyte   }
  25. {   at the memory location pointed to by address.     }
  26. procedure poke ( address: integer; abyte: byte );
  27.     external;
  28.  
  29. {$iDIRCTRY.P }
  30.  
  31. { Simple driver for procedure directory.  Constructs a string of }
  32. { 11 chars = '?'.  First char is the binary value of the requested }
  33. { drive unit.  }
  34. procedure list;
  35. var
  36.   title : strng12;
  37.   ch    : char;
  38.   i    : byte;
  39.  
  40.     function toupper ( ch: char ): char; external;
  41.  
  42. begin
  43.   title := '0???????????'; { 12 chars. 1st char = drive unit }
  44. {
  45.   Example string to search for all *.COM files on logged in dr unit...
  46.       title := '0????????COM';
  47.   NOTE: MUST be in uppercase!
  48. }
  49.   write ( 'LIST DISK DIRECTORY: UNIT "A" OR "B"? ' );
  50.   readln ( ch );
  51.   ch := toupper(ch);
  52.  
  53.   { construct the proper binary unit identifier:
  54.     0 = logged in drive unit
  55.     1 = drive unit 'A'
  56.     2 = drive unit 'B'
  57.   }
  58.   title[1] := chr( ord(ch) - ord('A') + 1 );
  59.   writeln;
  60.   directory ( title );
  61.   writeln
  62. end{ list };
  63.  
  64. {$C+}{ enable control-c keypress checking in main program }
  65.  
  66. BEGIN {MAIN }
  67.   repeat
  68.     list
  69.   until false
  70. END.
  71.