Preparation

DIP switch 1-4controls the use of the FX’s 2K RAM buffer. You can use this RAM memory as a large text buffer to smooth printer/com- puter communications, or you can store in it a set of user-defined characters. Unfortunately, it can’t serve both purposes simultane- ously. In this and succeeding chapters, we’ll use this RAM area for user-defined characters. So set switch 1-4 off before proceeding.

Character DefinitionCharacters are defined with the ESCape "&" command sequence. The format is:LPRINT CHR$(27)"&"CHR$(r)CHR$(c1)CHR$(c2);

The r tells the printer in which RAM area the characters are to be stored. With a stock printer, there is only one area available: RAM area 0.

The notations c1 and c2 specify the range of characters to be defined. You can use the entire range of ASCII numbers from 0 to 255 (for which the ROM characters are shown in Appendix A), except for those areas where control codes reside (0 to 31, 127 to 159, and 255). You can also use some of the control-code locations, but only after special ESCape codes are issued. We’ll get to that a bit later.

Here’s how c1 and c2 work. Suppose you want to redefine the letters from A to E. The associated ASCII numbers are 65 to 69, so you simply let c1 be 65(A) and c2 be 69(E). Any of the keyboard characters can be redefined in a similar manner. For example, defining c1 as 97 and c2 as 101 selects lowercase letters a through e; defining c1 as 33 and cz as 43 selects the symbols ! through + .

To simplify things a bit, the ASCII symbols can be used in place of CHR$(c1) and CHR$(c2). For example, either:

LPRINT CHR$(27)"&"CHR$(0)CHR$(65)CHR$(69);or:LPRINT CHR$(27)"&"CHR$(0)"AE";

selects characters A through E. On some occasions you may wish to define only one character. That’s O.K., too. Just use the same number or letter for c1 and c2:

130 LPRINT CHR$(27)"&"CHRS(0)"EE";

200