Turbo Prolog
Turbo Prolog
Turbo Prolog
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
7 Tutorial V: Seeing Through<br />
<strong>Turbo</strong> <strong>Prolog</strong>'s Windows<br />
<strong>Turbo</strong> <strong>Prolog</strong> allows you to incorporate windows in your programs (in full color if you<br />
have the necessary hardware) and have full access to DOS. Before introducing <strong>Turbo</strong><br />
<strong>Prolog</strong>'s first-class windowing capabilities, this chapter describes how to determine the<br />
screen attribute values that will be used in window commands to determine the colors<br />
both inside a given window and for the window frame (if there is one).<br />
The chapter concludes with two exciting illustrations of the potential of <strong>Turbo</strong> <strong>Prolog</strong>'s<br />
windowing features (an arcade style "shoot-em-up" game and a word guessing game)<br />
and then gives a few simple examples of how to interface your <strong>Turbo</strong> <strong>Prolog</strong> programs<br />
with DOS.<br />
SETTING THE SCREEN DISPLAY ATTRIBUTES<br />
<strong>Turbo</strong> <strong>Prolog</strong> allows you to control such screen display characteristics as inverse video,<br />
underlining and colors. This information is passed to standard predicates via an attribute<br />
value which, among other things, determines the color of the characters (the foreground)<br />
and the color behind the characters (the background). It is possible to give<br />
attributes for single characters or for a whole screen area.<br />
If your computer has a Monochrome Display Adapter, display attribute values are<br />
calculated as follows:<br />
• Choose the integer representing the desired foreground and background combination<br />
from Table 7- I.<br />
• Add I if you want characters to be underlined in the foreground color.<br />
• Add 8 if you want the white part of the display to be in high intensity.<br />
• Add 128 if you want the character to blink.<br />
77