home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mod201j.zip / modula2.exe / os2src / crt.def < prev    next >
Text File  |  1995-06-28  |  5KB  |  254 lines

  1. DEFINITION MODULE CRT;
  2. (*
  3.     Title     : An adaption of the Turbo Pascal CRT Unit
  4.     Author    : I.R. Matters (Ian.Matters@anu.edu.au)
  5.     System    : Juergen Neuhoff's Modula-2 compiler on OS/2 v3.0
  6.     Version   : 1.03
  7.     Last Edit : 28 June 1995
  8. *)
  9.  
  10.  
  11. FROM SYSTEM IMPORT BYTE, WORD;
  12.  
  13.  
  14. CONST
  15.  
  16.   (* CRT modes *)
  17.  
  18.   BW40         =   0;  (* 40x25 B/W on Color adapter     *)
  19.   CO40         =   1;  (* 40x25 Color on Color adapter   *)
  20.   BW80         =   2;  (* 80x25 B/W on Color adapter     *)
  21.   CO80         =   3;  (* 80x25 Color on Color adapter   *)
  22.   BW132        =   4;  (* 132x25 B/W on Color adapter    *)
  23.   CO132        =   5;  (* 132x25 Color on Color adapter  *)
  24.   Mono         =   7;  (* 80x25 on Monochrome adapter    *)
  25.   Font8x8      = 256;  (* Add-in for 43 or 50 line modes *)
  26.  
  27.   (* Foreground and background color constants *)
  28.  
  29.   Black        =   0;
  30.   Blue         =   1;
  31.   Green        =   2;
  32.   Cyan         =   3;
  33.   Red          =   4;
  34.   Magenta      =   5;
  35.   Brown        =   6;
  36.   LightGray    =   7;
  37.  
  38.   (* Foreground color constants *)
  39.   
  40.   DarkGray     =   8;
  41.   LightBlue    =   9;
  42.   LightGreen   =  10;
  43.   LightCyan    =  11;
  44.   LightRed     =  12;
  45.   LightMagenta =  13;
  46.   Yellow       =  14;
  47.   White        =  15;
  48.  
  49.   (* Add-in for foreground blinking *)
  50.  
  51.   Blink        = 128;
  52.  
  53.  
  54. TYPE
  55.  
  56.   (* Cursor modes *)
  57.  
  58.   CursorModes  = (NoCursor, SmallCursor, LargeCursor);
  59.  
  60.  
  61. VAR
  62.  
  63.   (* Interface variables *)
  64.  
  65.   LastMode : WORD;  (* The result of the most recent  *)
  66.                     (* TextMode call - Read only      *)
  67.  
  68.   TextAttr : BYTE;  (* Current text attribute         *)
  69.                     (* Read only - use SetTextAttr to *)
  70.                     (* set this variable              *)
  71.  
  72.   WindMin  : WORD;  (* Window upper left coordinates  *)
  73.   WindMax  : WORD;  (* Window lower right coordinates *)
  74.  
  75.  
  76. (* Procedure definitions *)
  77.  
  78. PROCEDURE KeyPressed(): BOOLEAN;
  79. (*
  80.    Has a character key been pressed on the keyboard?
  81. *)
  82.  
  83. PROCEDURE ReadKey(): CHAR;
  84. (*
  85.    Read the current key from the keyboard buffer without echo
  86. *)
  87.  
  88. PROCEDURE TextMode (Mode: CARDINAL);
  89. (*
  90.    Select a new text screen mode
  91. *)
  92.  
  93. PROCEDURE Window (X1, Y1, X2, Y2: CARDINAL);
  94. (*
  95.    Set the current window location and size
  96. *)
  97.  
  98. PROCEDURE GotoXY (X, Y: CARDINAL);
  99. (*
  100.    Position the cursor relative to the current window
  101. *)
  102.  
  103. PROCEDURE CursorXY (VAR X, Y: CARDINAL);
  104. (*
  105.    Read the current cursor position relative to the current window
  106. *)
  107.  
  108. PROCEDURE WhereX(): CARDINAL;
  109. (*
  110.    Return the current horizontal cursor position in the current window
  111. *)
  112.  
  113. PROCEDURE WhereY(): CARDINAL;
  114. (*
  115.    Return the current vertical cursor position in the current window
  116. *)
  117.  
  118. PROCEDURE ClrScr;
  119. (*
  120.    Clear the current window and set the cursor home
  121. *)
  122.  
  123. PROCEDURE ClrEOL;
  124. (*
  125.    Clear the current window to the end of the current line
  126. *)
  127.  
  128. PROCEDURE ClrEOS;
  129. (*
  130.    Clear the current window to the end of the screen
  131. *)
  132.  
  133. PROCEDURE InsLine;
  134. (*
  135.    Insert a blank line at the cursor position
  136. *)
  137.  
  138. PROCEDURE DelLine;
  139. (*
  140.    Delete the line at the cursor position
  141. *)
  142.  
  143. PROCEDURE TextColor (Color: CARDINAL);
  144. (*
  145.    Select the foreground character color
  146. *)
  147.  
  148. PROCEDURE TextBackground (Color: CARDINAL);
  149. (*
  150.    Select the background color
  151. *)
  152.  
  153. PROCEDURE LowVideo;
  154. (*
  155.    Select low intensity character colors
  156. *)
  157.  
  158. PROCEDURE HighVideo;
  159. (*
  160.    Select high intensity character colors
  161. *)
  162.  
  163. PROCEDURE NormVideo;
  164. (*
  165.    Return the text attributes to the default setting
  166. *)
  167.  
  168. PROCEDURE Delay (mS: CARDINAL);
  169. (*
  170.   Delay for a number of milliseconds
  171. *)
  172.  
  173. PROCEDURE Sound (Hz, mS: CARDINAL);
  174. (*
  175.   Produce a sound at the desired frequency for a number of milliseconds
  176. *)
  177.  
  178. PROCEDURE Bell;
  179. (*
  180.   Make a pleasant bell sound
  181. *)
  182.  
  183. PROCEDURE Buzz;
  184. (*
  185.   Make a buzzing sound
  186. *)
  187.  
  188. PROCEDURE ClearKB;
  189. (*
  190.    Flush the keyboard type-ahead buffer
  191. *)
  192.  
  193. PROCEDURE Cursor (Mode: CursorModes);
  194. (*
  195.   Set the cursor to the requested mode 
  196. *)
  197.  
  198. PROCEDURE CurrentCursor(): CursorModes;
  199. (*
  200.   Get the cursor mode 
  201. *)
  202.  
  203. PROCEDURE ByteToWord (B : BYTE): WORD;
  204. (*
  205.    Convert a byte to a word
  206. *)
  207.  
  208. PROCEDURE Lo (W : WORD): BYTE;
  209. (*
  210.    Extract the low order byte from a word
  211. *)
  212.  
  213. PROCEDURE Hi (W : WORD): BYTE;
  214. (*
  215.    Extract the high order byte from a word
  216. *)
  217.  
  218. PROCEDURE ScreenChar(): CHAR;
  219. (*
  220.    Read a character from the screen at the cursor position
  221. *)
  222.  
  223. PROCEDURE MaxWidth(): CARDINAL;
  224. (*
  225.    What is the full screen width?
  226. *)
  227.  
  228. PROCEDURE MaxHeight(): CARDINAL;
  229. (*
  230.    What is the full screen height?
  231. *)
  232.  
  233. PROCEDURE InsChar;
  234. (*
  235.    Insert a blank character at the cursor position
  236. *)
  237.  
  238. PROCEDURE DelChar;
  239. (*
  240.    Delete the character at the cursor position
  241. *)
  242.  
  243. PROCEDURE InitialMode(): CARDINAL;
  244. (*
  245.    What was the initial screen mode?
  246. *)
  247.  
  248. PROCEDURE SetTextAttr (Attr : BYTE);
  249. (*
  250.    Set the screen colors to the required attributes
  251. *)
  252.  
  253. END CRT.
  254.