module screen(input,output);

	type            word = 0..65535;
	
	[GLOBAL] procedure set_inverse;
		var     print_char : char;
		begin
		print_char := chr(27); write(print_char);
		print_char := chr(91); write(print_char);
		print_char := chr(48); write(print_char);
		print_char := chr(59); write(print_char);
		print_char := chr(53); write(print_char);
		print_char := chr(59); write(print_char);
		print_char := chr(55); write(print_char);
		print_char := chr(109); write(print_char);
		end;{set_inverse}

	[GLOBAL] procedure reset_crt;
		var     print_char : char;
		begin
		print_char := chr(27); write(print_char);
		print_char := chr(91); write(print_char);
		print_char := chr(48); write(print_char);
		print_char := chr(109); write(print_char);
		end;{clear}

	[GLOBAL] procedure set_ansi_mode;
			var     print_char : char;
		begin
			print_char := chr(27); write(print_char);
			print_char := chr(60); write(print_char);
		end;{set_ansi_mode}

	[ global ] procedure bold_crt;
		var     print_char : char;
		begin
		print_char := chr(27); write(print_char);
		print_char := chr(91); write(print_char);
		print_char := chr(49); write(print_char);
		print_char := chr(109); write(print_char);
		end;{clear}

	[GLOBAL] procedure request_term_parm;
		var     print_char : char;
		begin
		print_char := chr(27); write(print_char);
		print_char := chr(91); write(print_char);
		print_char := chr(48); write(print_char);
		print_char := chr(120); write(print_char);
		end;{request_term_parm}

	[GLOBAL] procedure ring_bell;
	var bell_chr	: char;
	    i		: integer;
	begin
		bell_chr := chr(7);
		for i := 1 to 15 do
			writeln(bell_chr);
	end;{ring_bell}

	{ procedure goto_xy postions the cursor to a requested line and	}
	{ column.							}
	[GLOBAL] procedure goto_xy ( x,y : word );
	function lib$set_cursor( line, column : word ) : integer ; extern ;
		{ if the return code is odd then everything is okay, otherwise 	}
		{ the program halts. to use check with a system service code 	}
		{ the statement as follows:					}
		{								}
		{	check ( sys$system_service(parameters));		}
		{								}
		procedure check (it : integer);
			begin
			if not odd(it) then
				begin
				writeln('****** error - terminating program *****',it);
				halt;
				end;{if}
			end;{check}
	begin
		check ( lib$set_cursor(x,y));
		end;{goto_xy}

	{ procedure clear_screen erases the page starting at the line 	}
	{ an cloumn requested as an input parameter.			}
	[GLOBAL] procedure clear_screen ( line, column : word );
		function lib$erase_page( line, column : word ) : integer ; extern;
		{ if the return code is odd then everything is okay, otherwise 	}
		{ the program halts. to use check with a system service code 	}
		{ the statement as follows:					}
		{								}
		{	check ( sys$system_service(parameters));		}
		{								}
		procedure check (it : integer);
			begin
			if not odd(it) then
				begin
				writeln('****** error - terminating program *****',it);
				halt;
				end;{if}
			end;{check}
	begin
		check ( lib$erase_page(line,column));
		end;{clear_screen}
end.
