USES DOS,CRT,fx;

PROCEDURE GETFILE;
var top,max,active:integer;
    files:array[1..100] of string[12];
    DirInfo: SearchRec;
    c : char;
    x,y:integer;
    maxl:byte;
    active_two:byte;
    begin

    fillchar(files,sizeof(files),#0);
    top:=1;
    active:=1;
    max:=0;
    maxl:=0;
    active_two:=1;
    FindFirst('*.mnu', Archive, DirInfo);
          while DosError = 0 do
                begin
                 inc(max);
                 inc(maxl);
                 files[max]:=(DirInfo.Name);
                 FindNext(DirInfo);
                end;

    repeat
    for x:=1 to 10 do begin
                      if x=active then
                      printxy(1,4+x,'|B1|15'+FILES[X+TOP]) ELSE
                      printxy(1,4+x,'|B0|15'+files[x+top]);
                      textattr:=7;
                      clreol;
                      if x=max then x:=10;
                      end;
    c:=readkey;
    case c of
   #72 : If Active > 1 then Dec(Active) else If Top > 1 then Dec(Top);
   #75 : If Active_Two > 1 then Dec(Active_Two);
   #77 : If Active_Two < 5 then Inc(Active_Two);
   #27 : Begin
          asm mov ax,3; int 10h; end;
          Halt(0);
         End;
   #80 : if active=max-1 then begin end else
        Begin
          If max > 10 then
           Begin
            If Active < 10 then Inc(Active) else If Top+10 < max then Inc(Top);
            End else If Active < max then Inc(Active);
         End;
    end;
    until c=#13;
    end;

begin
textattr:=7;
clrscr;
getfile;
end.