Chapter 11.1 - The character set |
The letters, digits, punctuation marks & so on that can appear in strings are called characters, & they make up the alphabet, or character set, that the ZX81 uses. Most of these characters are single symbols, but there are sone more, called tokens, that represent whole words, such as PRINT, STOP, **, & so on. There are 256 characters altogether, & each one has a code between 0 & 255. There is a complete list of them in appendix A. To convert between codes & characters, there are two functions, CODE & CHR$. CODE is applied to a string, & gives the code of the first character in the string (or 0 if the string is empty). CHR$ is applied to a number, & gives the single character string whose code is that number. This program prints out the entire character set. 10 LET A=0 20 PRINT CHR$ A; 30 LET A=A+1 40 IF A<256 THEN GOTO 20 At the top you can see the symbols ", £, $ and so on up to Z, which all appear on the keyboard & can be typed in when you have the ![]() ![]() ![]() When you've experimented a bit, you should still have the character set at the top; if not, then run the program again. Right at the beginning are space & ten patterns of black, white & grey blobs; further on there are eleven more. These are called the graphics symbols & are used for drawing pictures. You can enter these from the keyboard, using graphics mode (except for space, which is an ordinary symbol using the ![]() ![]() ![]() ![]() Here are the 22 graphics symbols. ![]() Now look at the character set again. The tokens stand out quite clearly in two blocks: a small group of three (RND, INKEY$ & PI) after Z, & a larger group (starting with the quote image after ![]() The rest of the characters all seem to be ? This is actually just the way they get printed - the real question mark is between : and (. Of the spurious ones, some are for control characters like ![]() Summary Functions: CODE, CHR$ |
![]() ![]() ![]() |