Run the program to see the printout below:

As you can see, both sets of characters (the original ROM characters that the printer normally uses and the user-defined character set) remain in the printer available for your use. The command to switch between the two sets is used in lines 180 and 200 and has the following format:

E S C % n

If n is 0, the normal ROM character set is selected. (This is the default.) If n is 1, the user-defined character set is selected.

You can switch between character sets at any time, even in the middle of a line. To try it, place semicolons at the end of lines 170 and 190 in the program above.

Copying ROM to RAM

After running the program above, if you select the user-defined character set and try to print other characters, the only one that will print is the heart. If you send the code for a character that is not defined, it is printed as a space.

In many cases, you will want to redefine only a few of the characters, leaving the rest of the alphabet as it is. As you have seen, it is possible to switch back and forth between the normal character set and the user-defined character set. Normally, it is more convenient to copy all of the standard characters from ROM to the area of RAM that holds the user-defined character set. The format of the command to do this is as follows:

ESC : 0 0 0

If you use this command at the beginning of a program, then define the special characters you want to change, you can then select the user- defined character set and use it as your normal character set. There is then no need to switch back and forth between sets.

5-16

Graphics and User-defined Characters