User Defined Characters; Printing Press - AMSTRAD cpc 6128 User Instruction

Integrated computer/disc system
Hide thumbs Also See for cpc 6128:
Table of Contents

Advertisement

User defined characters
One of the first applications of binary numbers that you are likely to come across will
be when designing characters for use with the S Y M B 0 L command. If the character is
drawn on an
8
by
8
grid then each of the eight rows can be converted to a binary
number by putting a 1 for each pixel that is to be inked and a zero for each that should
be invisible, i.e. set to the paper colour. These eight numbers are then passed to the
S Y M B 0 L command. For example, to define a house character:
*
= 0000 HH'J0 = &08 =
8
= 8
****
= 00111100 = &3C =
32+16+8+4
= 60
*
*
= 01000010 = &42 =
64
+2 = 66
* * * *
= 10100101 = &A5 = 128
+32
+4
+1 = 165
*
*
= 10000001 = &81 = . 128
+1 = 129
* ** * *
= 10110101 = &B5 = 128
+32+16
+4
+1 = 181
* **
*
= 10110001 = &B1 = 128
+32+16
+1 = 177
********
= 11111111 = &FF = 128+64+32+16+8+4+2+1 = 255
.... the command is:
SYMBOL 240,8,60,66,165,129,181,177,255
.... or ....
SYMBOL 240,&08,&3C,&42,&A5,&81,&B5,&B1,&FF
.... or ....
SYMBOL
240i&X00001000,
&X00111100, &X01000010, &X10100101,
&X10000001, &X10110101, &X10110001, &X11111111
To print the user defined character, you would type:
PRINT CHR$(240)
Finally, to group blocks of characters together, you may for example specify:
semi$=CHR$(240)+CHR$(240)
PRINT semi$
.... or ....
terrace$=STRING$(15,240)
PRINT terrace$
Printing press ..
B.
PR I N T is one of the first ever commands that you use when you start to learn
computing. It's one ofthose
BASIC
commands that does what it says really .... or does
it? In fact there's a lot more to PR I N T than at first it seems, for instance WHERE
should it print? and HOW should it print? ....
At your leisure ....
Chapter 9 Page 21

Advertisement

Table of Contents
loading

Table of Contents

Save PDF