Practice Makes Perfect - Introducing Print - AMSTRAD CPC464 User Manual

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

Advertisement

c. <based numbers> are numbers that are declared to be either binary or hexadecimal (see Appendix
II):
Decimal form (the default condition) 100
Hexadecimal form 864 or or &H64 . . . . . . . . . . . . . . . . . .
Binary form &X 1 10 0 1 0 0
(the' H' isoptiona1)
. . . . . . . . . . . . . . (the ' X' is compulsory)

3.5 Practice makes perfect - introducing PRINT

In order to demonstrate the way this terminology works, here are some examples of BASIC at work.
One BASIC keyword that displays most of the features of the terminology is the simple command
PRINT . A command is a BASIC keyword or statement that will operate with the computer in either
direct entry mode or program mode. A function requires the presence of a command to ' invoke' the
function eg:
PRINT FRE("")
To get the CPC464 to give you the answer to a question, you must tell it three things:
1. Where you want the answer to appear - ie the screen, the printer or ' elsewhere'
2. You must give the computer the ' data' to work with
3. You must tell the computer what to do with the data
PRINT is used to tell the computer to put the results of a command onto a specific output ' stream' -
where a stream is identified by a number from 0 to 9, which is described in the analysis of BASIC as
a <stream expression> - which is the number that defines the particular stream to be used:
0...7 are text streams to text ' windows' that have been previously set up with the WINDOW
command.
8 is the parallel printer port, and can only be used if a Centronics compatible printer has been
attached correctly.
9 is a cassette output file- which must have been properly opened earlier in the program.
A concise form of the P R I NT command (not employing the ' PRINT USING' format template) is thus:
PRINT [#<stream expression>][<print list>]
. . ..so far. The square brackets mean that you don' t have to declare the <stream expression,, nor do
you actually have to give the PRINT command a list of anything to print at all (in which case the
computer responds with an empty line -try it). If you don' t direct the output to a particular stream
the CPC464 assumes you mean stream # 0 , the default screen stream. Try this line (remember to
press [ENTER] at the end to tell the computer to deal with the instructions you have given it):
PRINT "HELLO"

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents