                     { --- Screen prompts --- }

procedure Cursor_to(x,y:integer);
begin GotoXY(x,y); end;

procedure prompt(str:prompt_string);
begin Cursor_to(PROMPT_X,PROMPT_Y); ClrEol; LowVideo; write(str); HighVideo; end;

procedure unprompt;
begin Cursor_to(cx,cy); end;

procedure prompt_for_YN(str:prompt_string;toggle:boolean);
const MSEC = 750;
var x,y:integer;
begin
prompt(str+'? (Y/N) ');
x:=PROMPT_X+length(str)+8; y:=PROMPT_Y;
repeat
    if toggle then
        repeat
        Cursor_to(cx,cy); if not KeyPressed then Delay(MSEC);
        Cursor_to( x, y); if not KeyPressed then Delay(MSEC);
        until KeyPressed;
    read(KBD,ch); ch:=UpCase(ch);
until (ch='Y') or (ch='N');
unprompt; yes_flag:= (ch='Y');
end; { prompt_for_YN }

procedure prompt_for_esc(str:prompt_string);
begin
prompt(str+' Press <ESC>');
repeat read(KBD,ch) until ch=ESC;
unprompt;
end; { prompt_for_esc }

procedure prompt_for_filename(var name:filename_string; str:prompt_string);
var i:integer;
begin
prompt(str); readln(name); unprompt;
for i:=1 to length(name) do name[i]:=UpCase(name[i]);
end; { prompt_for_filename }

procedure prompt_for_string(str:prompt_string;var substring:line_string);
var i:integer;
begin
prompt(str); readln(substring); unprompt;
end; { prompt_for_string }

procedure prompt_1st_and_read_2nd_char;
begin
Cursor_to(PROMPT_X,PROMPT_Y); write('^',chr(ord(ch)+$40));
read(KBD,ch);
if ch<>#$7F then ch:=chr(ord(ch) and $1F);
Cursor_to(PROMPT_X+2,PROMPT_Y); write('^',chr(ord(ch)+$40));
end; { prompt_1st_and_read_2nd_char }

