SHAPE
Format: SHAPE (X, "18 hex numbers")
Supported by: COMX BASIC V1.00
Similar commands:
Pecom 32 BASIC, Pecom 64 BASIC 1.0 and 4.0: CHRGEN
It is possible to redefine the character printed by the pressing of a key e.g. it is possible to redefine the character for decimal code 65 such that pressing key A will give, for example, a Chinese character instead of the letter A. This is done by using the command SHAPE which has the form (for TV using the PAL system), SHAPE (X, "18 hex numbers") where X is an integer corresponding to the decimal code of the key. Within the pair of double quotes are 18 hexadecimal numbers which together specify the colour and shape of the character. Try,
SHAPE (65, "48487E6A7E48484800")
Pressing key A will cause a Chinese character to be printed in magenta. In fact, notice that all letter A's on the screen have been replace after the execution of the above SHAPE command!
Try the following examples and you will appreciate the magic done by these commands.
SHAPE (153, "8F8D8C5C7E7E7E5C00")
An apple will be printed when you "PRINT CHR$ (153). "
SHAPE (119, "84848CBF9E9C94A400")
Whenever you press the letter "W" with the SHIFT key being held down, the computer will respond by giving you a green star.
SHAPE (20, "00000000DFFFFFDF00") SHAPE (21, "00FCFCFCFFFFFFFF00") SHAPE (22, "00000000FEFFFFFE00")
After pressing CNTLT, CNTLU, and CNTLV, you can get a submarine on the screen.
For TVs using the NTSC system, instead of using 18 hex numbers, use 16 hex numbers to specify the shape.
To determine the 9 pairs of hex numbers, consider a rectangle of 8 units by 9 units as follows:
Consider each row of 8 squares. The leftmost two squares, which are to be filled in by 1 's and 0's, determine the colour of the remaining 6 squares in accordance with Table 2. Each of the rightmost 6 squares of each row is represented by 1 if that square is "painted" or "filled", by 0 if it is not (i.e. if it has the same colour as the background). Thus, the first two columns of squares (from the left) are used to define colours, whereas the rightmost 6 columns of squares (6 x9 squares) are used to define the shape. Each row is coded into two hex numbers. With there being 9 rows, 18 hex numbers are needed to define both the colours and the shape. For example, consider the 4th row from the top of figure 1, if the magenta colour is chosen, the leftmost two bits should be "01" (see Table 2). The remaining six bits are "101010" as shown in figure 1, coding a "filled square" into "1", and an "empty square" into "0". The eight bit pattern "01101010" may be represented by the two hex numbers 6A. Hence, the 4th pair (corresponding the 4th row) of hex numbers is 6A (see figure 1). Note that for PAL system, the resolution per character is 6 x 9 dots. For NTSC, only 8 pairs of hex digit is required giving 8 x 8 dots if the hex string is longer than required, the rest is ignored. In both cases, each character can be multicoloured. Note also that string variables can be used instead of literals when defining a shape, also the userredefined characters or symbols can be printed like any other normal characters.
The default character set will be restored during powerup or system reset (i.e. pressing of RT and space bar simultaneously)
Left most two bits 
Colour 
Colour 

0 
0 
BLACK 
RED 
0 
1 
BLUE 
MAGENTA 
1 
0 
GREEN 
YELLOW 
1 
1 
CYAN 
WHITE 
Table 2: Colours of one row of squares as a function of the first two bits