home *** CD-ROM | disk | FTP | other *** search
- { CURSOR.PAS - A collection of cursor movement and control routines for TOS
- programs. These routines provide access to the VT52 escape sequences, as
- well as providing more compatibility with Turbo Pascal. Include this file
- along with your program in order to use the routines. Alternatively, you
- can make this a separate module.
- }
-
- { Put a single character to the console device (the character's value is
- received as an integer!) }
- PROCEDURE out_char( c: integer );
-
- CONST
- screen = 2;
-
- PROCEDURE bconout( device, c: integer );
- BIOS(3);
-
- BEGIN
- bconout( screen, c );
- END;
-
- { Put a two-character escape sequence to the console device (an escape
- followed by a single character) }
- PROCEDURE out_escape( c: char );
-
- CONST
- escape = 27;
-
- BEGIN
- out_char( escape );
- out_char( ord(c) );
- END;
-
- { Clear from the cursor to the end of the current line }
- PROCEDURE ClrEol;
- BEGIN out_escape( 'K' ) END;
-
- { Clear the screen and move the cursor to the upper left position }
- PROCEDURE ClrScr;
- BEGIN out_escape( 'E' ) END;
-
- { Initialize the console device }
- PROCEDURE CrtInit;
- BEGIN out_escape( 'v' ) END;
-
- { Reset the console device }
- PROCEDURE CrtExit;
- BEGIN out_escape( 'w' ) END;
-
- { Delete the current line, moving all lines below up by one line }
- PROCEDURE DelLine;
- BEGIN out_escape( 'M' ) END;
-
- { Insert a blank line at the current position, moving the current line and
- all lines below down by one line. The bottom line on the screen is lost }
- PROCEDURE InsLine;
- BEGIN out_escape( 'L' ) END;
-
- { Move to a specific screen coordinate. Home is (1,1). }
- PROCEDURE GotoXY( x, y: integer );
- BEGIN out_escape( 'Y' ); out_char( 31+x ); out_char( 31+y ) END;
-
- { Reverse foreground and background colors for text display }
- PROCEDURE InverseVideo;
- BEGIN out_escape( 'p' ) END;
-
- { Restore normal colors }
- PROCEDURE NormVideo;
- BEGIN out_escape( 'q' ) END;
-
- { Choose a foreground color index for text display }
- PROCEDURE TextColor( color: integer );
- BEGIN out_escape( 'b' ); out_char( color ) END;
-
- { Choose a background color index for text display }
- PROCEDURE TextBackground( color: integer );
- BEGIN out_escape( 'c' ); out_char( color ) END;
-
- { ---------------------------------------------------------------------------
- The following procedures and functions are not in the Turbo Pascal library:
- --------------------------------------------------------------------------- }
-
- { Move the cursor up one line }
- PROCEDURE CursUp;
- BEGIN out_escape( 'A' ) END;
-
- { Move the cursor down one line }
- PROCEDURE CursDown;
- BEGIN out_escape( 'B' ) END;
-
- { Move the cursor right one column }
- PROCEDURE CursRight;
- BEGIN out_escape( 'C' ) END;
-
- { Move the cursor left one column }
- PROCEDURE CursLeft;
- BEGIN out_escape( 'D' ) END;
-
- { Move the cursor to the upper left corner of the screen }
- PROCEDURE CursHome;
- BEGIN out_escape( 'H' ) END;
-
- { Same as CursUp, but inserts a blank line at the top of the screen }
- PROCEDURE CursUp2;
- BEGIN out_escape( 'I' ) END;
-
- { Clear from cursor to end of the screen }
- PROCEDURE ClrEos;
- BEGIN out_escape( 'J' ) END;
-
- { Turn on the flashing cursor }
- PROCEDURE CursOn;
- BEGIN out_escape( 'e' ) END;
-
- { Turn off the flashing cursor (i.e., no cursor is displayed) }
- PROCEDURE CursOff;
- BEGIN out_escape( 'f' ) END;
-
- { End of CURSOR.PAS }