Program dir;
{Extract and print MSDOS directory entries}

type
  regpack = record
              ax,bx,cx,dx,bp,si,ds,es,flags: integer;
            end;

var
  recpack:       regpack;                {record for MsDos call}
  FCB:           array[0..32] of byte;   {area for file control block}
  filename:      array[1..32] of char;
  i,j:           integer;
  DataSeg:       integer;

begin
  fillchar(FCB,sizeof(FCB),0);
  for i := 1 to 32 do
    FCB[i] := $3F;  {prefill the filename with wildcard characters}

  recpack.ax := $1A shl 8 ;
  recpack.dx := Ofs(filename[1]) ;
  recpack.ds := Seg(filename[1]) ;
  MsDos(recpack) ;

  recpack.ax := $11 shl 8 ; {11H in AH by shifting left 8 bits}
  recpack.dx := Ofs(FCB) ;  {load offset of FCB in dx}
  recpack.ds := Seg(filename[1]) ;
  MsDos(recpack) ; {call MsDos for first file search}

  write('Filename = ');
  for i := 1 to 32 do write(filename[i]);
  delay(1000);

end.
               BEGIN
                        ASSIGN (RFILE,