AMSTRAD CPC464 User Manual page 101

Cpc464 colour personal computer 64k
Hide thumbs Also See for CPC464:
Table of Contents

Advertisement

6 9 0 G O T O 5 2 0
7 0 0 L O C A T E 1 2 , 1 9
7 1 0 I F T<S THEN 680
7 2 0 P R I N T " T H E H O U S E W I N S "
7 3 0 G O T O 5 2 0
7 4 0 R E M D E A L C A R D
7 5 0 L E T C A R D = I N T ( R N D ( 1 ) * 5 2 + 1 )
7 6 0 I F P A C K ( C A R D ) = 1 T H E N G O T O 7 5 0
7 7 0 P A C K ( C A R D ) = 1
7 8 0 F = C A R D-1 3 * I N T ( C A R D / 1 3 )
7 9 0 I F F = 0 T H E N F = 1 3
8 0 0 I F F = 1 O R O R F > 1 0 T H E N G O T O 8 5 0
8 1 0 P R I N T F ; " O F " ;
8 2 0 IF F > 1 0 T H E N F = 1 0
8 3 0 P R I N T S U I T $ ( I N T ( C A R D -1 ) / 1 3 ) + 1 )
8 4 0 R E T U R N
8 5 0 I F F = l l T H E N P R I N T " J A C K O F " ;
8 6 0 I F F = 1 2 T H E N P R I N T " Q U E E N O F " ;
8 7 0 I F F = 1 3 T H E N P R I N T " K I N G O F " ;
8 8 0 I F F < > 1 T H E N G O T O 8 2 0
8 9 0 F = 1 1
9 0 0 P R I N T " A C E O F " ;
9 1 0 G O T O 8 3 0
Enter T for a ' twist' (your next card to add to those originally dealt to you), or S to stick and play the
house. We don' t claim that this is the last word in card games for your CPC464, but it will provide
you with a substantial bone upon which to add the meat of graphics and sound.
(Note that you must enter T(twist) or S(stick) in upper case capital letters).
4.13 Logical Expressions.
A major difference between a calculator and computer is the computer' s ability to handle logical
operations in applications like the conditional IF . . . . THEN sequence. To do this, the logical
operators treat the values to which they are applied as bit patterns (bitwise), and operate on the
individual bits. The description and use is entirely, well . . ..er logical - but it is notoriously difficult
to describe logic in simple terms without the precision of the concise definitions.
The two halves of the logical expression are known as the arguments. A logical expression comprises:
<argument>[<logical operator)<argument>]
where:
<argument> is: NOT <argument>
or: <numeric expression>
or: <relational expression>
or: (<logical expression>)
Both the arguments for a logical operator are forced to integer representation, and Error 6 results if
an argument will not fit into the integer range.
The logical operators, in order of precedence, and their effect on each bit are :
AND
Result is 0 unless both argument bits are 1
OR
Result is 1 unless both argument bits are 0
XOR
Result is 1 unless both argument bits are the same
AND is the most commonly employed logical operator, and does not mean ' add' .
P R I N T 1 0 A N D 1 0
Results in the answer 10.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents