ORIGINALLY PUBLISHED IN LIMA NEWSLETTER NOVEMBER 1990 All About Character Sets By: Andy Frueh, Lima UG I had written about using CTRL and FCTN keys as a form of "macro" since practicaly every CTRL keypress represents a keyword. All of this got me thinking about the TI's character set, and a lot of the information pertaining to it. What follows is a lot of miscellaneous data on the ASCII characters. Most people don't take much interest in character sets. You hit a key, a symbol shows up on the screen. A code is assigned to every character. These codes are numerical values from 0 to 255. A space (or more appropriately called a blank) is code 32, a capital D is 68, etc. The computer knows at least two things about each character. Its graphic (what it looks like) and its assignment (what keys you press to get that character). You can use both. For example, when you type in a program and use PRINT, DISPLAY, DISPLAY AT, or INPUT/LINPUT with a prompt, you are using the graphic representation. When you use an HCHAR or VCHAR, you must use the actual numerical ASCII code. You also do this with the CALLS KEY subprogram. The function ASC and CHR$ also use numerical representations. This information is all in the manual. There is some data that is not in the manuals, or is covered in technical jargon. When you use VCHAR, HCHAR, and CHR$, you can actually use values up to 32767. 256 is continually subtracted until you get a value in the 0-255 range. Not all codes have graphic representations. These are usually "empty" and appear as the blank/space character. 0 - Undefined (no key assignment/graphic) 1 to 15 - Function keys (see chart 1). Most of these can be accessed in programs using CALL KEY, but not as response to ACCEPT AT/INPUT statements. They have no graphic (unless a program gives it one. In that case, typing the character gives the pattern it was assigned.) 16 to 29 - Undefined (these are the same as 0 since they don't have graphics or key assignments and there really isn't an easy way to give them either.) 30 - This is the cursor, usually a black square. An assembly routine is usually needed to redefine its graphic. 31 - This is the screen border. It is a blank and the color of the border around the screen, not the color of the screen itself. It has no key assignment. 32 to 126 - The "standard" characters (see chart 2). These are such things as letters, numbers, and symbols used in everyday typing. They can be redefined in a program. 127 to 159 - These are called "user-defined" characters (see chart 3). They originally have no graphic. The manual is incorrect in that it says when a program ends, the characters blank out. This is not true. Also, these keys have key assignments and are used to represent BASIC keywords at first. All but one requies you press CTRL and another key. Character 127 used the FCTN key. 160 to 175 - Undefined (see above) 176 to 198 - These characters have key assignments (see chart 4), but no graphic, and no easy way to give any. They can be used with CALL KEY, but can not be displayed. 199 to 255 - Undefined (see above) Even those which I labeled as undefined have a use. You can access them through CHR$ and ASC functions. They are useful as markers when manipulating strings. If you are transmitting data from the TI to another computer, the other computer may have representations for these characters. Finally, each character string has a code between 0 and 255, accessable through CHR$ and ASC. The SEG$ function will let you address individual characters in strings, and the apersand operator (SHIFT 7) called concatenation will allow you to compose a string out of individual characters. If you have a program that keeps track of thousands of small integers and you can't fit them in available memory, strings are probably the answer. Chart 1 - Function Key Codes CODE KEY 1 FCTN 7 (AID) 2 Not useable in BASIC. It is associated with FCTN 4, but you can't really use this in BASIC. In Extended BASIC, an ON BREAK will work. 3 FCTN 1 (DELETE) 4 FCTN 2 (INSERT) 5 Used with QUIT. In Extended BASIC, a CALL LOAD disables this key. I am not sure whether you can use FCTN = and a key code of 5 in a program. 6 FCTN 8 (REDO) 7 FCTN 3 (ERASE) 8 FCTN S (left) 9 FCTN D (right) 10 FCTN X (down) 11 FCTN E (up) 12 FCTN 6 (PROCEED) 13 ENTER 14 FCTN 5 (BEGIN) 15 FCTN 9 (BACK) Chart 2 - Standard ASCII Characters These are in the User's Guide, Extended BASIC manual, and both BASIC's Quick Reference Card. Refer to these. Note that character 127 shouldn't really be in this group. Characters in this group include 32 to 126. Chart 3 - User Defined Characters CODE KEY 127 FCTN V 128 CTRL , 129 CTRL A 130 CTRL B 131 CTRL C 132 CTRL D 133 CTRL E 134 CTRL F 135 CTRL G 136 CTRL H 137 CTRL I 138 CTRL J 139 CTRL K 140 CTRL L 141 CTRL M 142 CTRL N 143 CTRL O 144 CTRL P 145 CTRL Q 146 CTRL R 147 CTRL S 148 CTRL T 149 CTRL U 150 CTRL V 151 CTRL W 152 CTRL X 153 CTRL Y 154 CTRL Z 155 CTRL . 156 CTRL ; 157 CTRL = 158 CTRL 8 159 CTRL 9 Chart 4 - Key Assigned/No Graphic These characters aren't discussed much in TI documentation. CODE KEY 176 CTRL 0 177 CTRL 1 178 CTRL 2 179 CTRL 3 180 CTRL 4 181 CTRL 5 182 CTRL 6 183 CTRL 7 184 FCTN , 185 FCTN . 186 FCTN / 187 CTRL / 188 FCTN 0 189 FCTN ; 190 FCTN B 191 FCTN H 192 FCTN J 193 FCTN K 194 FCTN L 195 FCTN M 196 FCTN N 197 FCTN Q 198 FCTN Y .PL 1