{**********************************************************************}
{ Scroll smoothly in 100 column text screen using cursor keys }
{ Quit on Escape key. }
{**********************************************************************}
procedure smooth_text_scroll;
const
KEY_ESC = $1B;
KEY_UP = 72;
KEY_DOWN = 80;
KEY_LEFT = 75;
KEY_RIGHT = 77;
KEY_ENTER = $0D;
const
msg : string[53] = 'This is a text line in the new 100 column text buffer';
var
x,y,i,key : integer;
begin
x := 0;
y := 0;
set_more_columns(100); { Select 100 text column mode }
set_cursor_position(0,0);
for i := 0 to 99 do { Fill newly organized text buffer }
write_string(i, 0, seg(msg), ofs(msg));
repeat
key := integer(readkey);
case key of
KEY_RIGHT: { Scroll right }
if x < 799 then inc(x);
KEY_LEFT: { Scroll left }
if x > 0 then dec(x);
KEY_UP: { Scroll up }
if y > 0 then dec(y);
KEY_DOWN: { Scroll down }
if y < 1399 then inc(y);
end;
smooth_scroll(x,y);
until key = KEY_ENTER;
smooth_scroll(0,0);
{--- Set default text mode }
i := get_display_type;
if i = MONO then set_mode(7)
else set_mode(3);
end;