home *** CD-ROM | disk | FTP | other *** search
Modula Definition | 1992-04-29 | 3.5 KB | 81 lines |
- (* Text BIOS I/O PROCEDURES 1992 Chris Harshman
- This module of procedures was designed to be able to use Fitted Software
- Tools Modula-2 Compiler to handle the screen with BIOS instead of DOS
- routines. This allows one to print to the screen in color, have more
- control of the screen cursor, and use fast routines that take up less
- space in your executable .EXE file. Standard Modula-2 string format is
- used. Unlike routines from InOut, these routines cannot be redirected
- through command line startup options or by the procedures in InOut designed
- to redirect input or output. NOTE: These routines do little error
- checking, so be carefull what values are entered. These routines should
- not crash your program though. Any user input should be checked by you
- the programmer before sending it to these routines. *)
-
- DEFINITION MODULE Text;
-
- PROCEDURE Cls;
- (* Clears the text screen. Faster than Clear but doesn't work on
- graphics screens. Uses color set by last Color statement. *)
-
- PROCEDURE Color(fgc,bgc:CARDINAL);
- (* Sets color attribute for screen output. The color range is 0-15 for
- foreground color and 0-7 for background. Must be called before using
- any of the Read or Write routines. *)
-
- PROCEDURE SetText;
- (* Sets the screen to 80x25 text color mode. *)
-
- PROCEDURE SetEgaText;
- (* Sets the screen to 132x25 text color mode on EGA cards that support it *)
-
- PROCEDURE SetEga43;
- (* Sets the screen to 132x43 text color mode on EGA cards that support it *)
-
- PROCEDURE SetCursor(v,h:CARDINAL);
- (* Sets the cursor to verticle row (from 0 to 24), horizontal column
- (from 0 to 79 or 131 depending on screen mode). *)
-
- (* All Read and Write routines will print in the colors specified by the
- last Color statement *)
- PROCEDURE GetKey(VAR ch,scan:CHAR);
- (* Waits for input from the keyboard. Puts the standard ASCII character
- in ch and the scan code character in scan. *)
-
- PROCEDURE Read(VAR ch:CHAR);
- (* Reads one character from the keyboard and outputs to screen using
- the BIOS calls in GetKey and Write. *)
-
-
- (* ReadCard and ReadInt will give unpredictable results if a number
- outside the ranges of the type are entered. *)
- PROCEDURE ReadCard(VAR n:CARDINAL);
- (* Reads a cardinal number from the keyboard. If a non-number character is
- entered in the input, it is ignored. (ex enter a1, the a is ignored) *)
-
- PROCEDURE ReadInt(VAR i:INTEGER);
- (* Reads an integer number from the keyboard. If a non-number character
- besides a leading - is entered, it is ignored. *)
-
- PROCEDURE ReadString(VAR str:ARRAY OF CHAR);
- (* Reads str from the keyboard using BIOS calls. *)
-
- PROCEDURE Write(ch:CHAR);
- (* Writes ch directly to the screen in Color using BIOS calls. *)
-
- PROCEDURE WriteCard(n,lngth:CARDINAL);
- (* Writes n in a field of Length lngth. lngth must be at least the length
- of the number to be printed or the leftmost numbers will be cut off.
- The length can be up to 10. *)
-
- PROCEDURE WriteInt(n:INTEGER; lngth:CARDINAL);
- (* Writes n in a field of Length lngth. lngth must be at least the length
- of the number to print or the leftmost numbers and/or sign are cut off.
- The length can be up to 10. *)
-
- PROCEDURE WriteString(str:ARRAY OF CHAR);
- (* Writes str directly to screen in current Color using BIOS calls. *)
-
- PROCEDURE WriteLn;
- (* Does a carriage return and linefeed, puts cursor on begining of next line *)
-
- END Text.