[inherit('sys$library:starlet','lib$spawn','smgdefs','smg$repaint_line',
'BB.PEN')]
module previous_message_directory_page;

[global] 
procedure previous_message_directory_page;

{Displays the previous 16 messages in the current topic message list if
 there are that many.  If there are fewer than 16 previous messages, then
 the message list is started from the top.}

var row, column : integer;

begin
  if (dir_start <> nil) then
    if (dir_start = dir_root) then
      begin
        smg$return_cursor_pos(menu_display,row,column);        
        smg$put_chars(main_display,
         	      'Top of messages. Forward for more messages.',
                      18,18,,smg$m_reverse);
        smg$set_physical_cursor(pasteboard,23,column);
      end
    else
      begin
        i := 0;
        while (dir_start^.previous <> nil) and (i < display_height) do
          begin
            dir_start := dir_start^.previous;
            i := i + 1;
          end;
        if (dir_start^.next <> nil) then
          dir_curr := dir_start^.next
        else
          dir_curr := dir_start;
        dir_list := dir_start;
        write_message_directory;
      end;
end;

end.
