program dosmenu;
uses crt;
var
key:char;
y,i,s:integer;
const
menu:array [1..5] of string = ('1)Item','2)Item','3)Item','4)Item','5)Quit');
begin
textbackground(0);
y := 1;
clrscr;
gotoxy(1,1);
for i := 1 to 5 do writeln(menu[i]);
gotoxy(0,1);
repeat
textbackground(7);
window(1,y,7,y);
textcolor(white);
clrscr;
write(menu[y]);
key := readkey;
case key of
'q':if y > 1 then
begin
textbackground(0);
clrscr;
gotoxy(1,y);
write(menu[y]);
dec(y);
end;
'a':if y < 5 then
begin
textbackground(0);
clrscr;
gotoxy(1,y);
write(menu[y]);
inc(y);
end;
#13:s := y;
#27:s := 5;
end
until s = 5;
end.