Sharp MZ-700 Series Owner's Manual page 83

Personal computer
Hide thumbs Also See for MZ-700 Series:
Table of Contents

Advertisement

2.6.2 Adding color specifications to the PRINT statement
j PRINT
|
[ f ,
b]
| variable
i
?
I
constant
Format
Function
Example
<
1
( variable
C
t , I
j constant
expression J
1 expression
= 1
or
f PRINT
1
9
[ f ,
b]
USING
"format string" ; variable <
I ,
variable ....)
f . . . . Foreground (character color) specification (a number from 0 to 7)
b . . . . Background color specification (a number from 0 to 7)
Adding the color specifications to the PRINT and PRINT USING statements des-
cribed on pages 37 and 38 makes it possible to display characters in a variety of
colors. In the format above, f indicates the character foreground color, and b indi-
cates the character background color. If only the foreground color is specified, the
current background color is used for display of characters; this is done by specify-
ing the foreground color, followed by a comma.
If only the background color is specified, the current foreground color is used for
display of characters; in this case, a comma must precede the background color
specification.
(Example 1)
P R I N T
( 6 ,
5 ]
A B O D E
P R
| N T
C, 4 )
" F G H I J
P R ! N T
( 7 , ) " V W X Y Z
. . . . Displays
the
letters
"ABCDE"
in
yellow against a background of light
blue.
Displays the letters " F G H I J " in yellow
against a background of green.
Displays the letter "VWXYZ" in green
against a background of white.
(Example 2) Let's try adding color to the automobile race program shown on page
46.
P R I N T
C, 1 3 " H "
Q = I N T ( 5 X R N D ( 1 ) ) + 2 : X = 3 3 X R N D ( 1 )
F O R
A = 1
T O
5
R E A D
M $
; " • " ; T A B ( X )
;
M $
;
T A B ( 3 7 ) ; " • "
1 0
20
3 0
4 0
5 0
60
7 0
80
9 0
1 00
1
1 0
1 2 0
1 3 0
1 4 0
1 5 0
1 6 0
P R I N T
T A B
( 0 )
P R I N T
CO. 1 )
P R I N T
( 7 , 1 )
N E X T
A
Y = 1 0 X R N D ( 1 )
F O R
A = 1
T O
Y
P R I N T
T A B ( 0 )
; " • " ;
P R I N T
T A B ( 3 7 )
; " • " :
R E S T O R E :
G O T O
2 0
D A T A "
a D B
" .
D A T A "
6SBSSS
" ,
" f f l B B S f f l "
D A T A "
M E
"
N E X T
With ordinary PRINT statements (those without color specifications), the fore-
ground and background colors used for character display are those which have been
specified with the latest COLOR statement.
-81

Advertisement

Table of Contents
loading

Table of Contents