Commodore‎ > ‎

PETSCII

Most of the CBM 8-bit computers come with two character sets.  One of them has been referred to as the uppercase/graphics character set, and it is usally the default set.  It does not have any lower-case letters!  See the ASCII-X page for details on that one.  The alternate characterset (which has upper and lower case, but fewer graphic symbols) was typically called lowercase/uppercase (or dual-case) character set, back in the day.  I don't know when it started, but more recently it has been given the name PETSCII, in honor of the PET computer (the first serious CBM 8-bit, not counting the KIM-1 kits), and standing for the PET Standard Code for Information Interchange.
 
Like many computers, PETSCII extends the 7-bit ASCII definition to 8-bits.  In theory this would double the number of characters from 128 to 256 (on most other computers it in fact does).  In reality, PETSCII only adds 64 characters (32 graphics and 32 control codes).  The other 64 are duplicates of the existing characters.  This is related to the fact that most CBM 8-bits can't generate reverse fonts in hardware, so half of the 256 font characters are reverse images of the other half.  So 128 normal characters, plus 64 control codes (which may appear as reverse-font characters) equals 192 "characters".  The remaining 256-192=64 are duplicates in the PETSCII code.
 
Note the computer (at least BASIC and the KERNAL) use the same codes regardless of which character set the user chooses for display.  This can make things confusing.  Many official publications and magazine articles from back in the day just use the term ASCII without referring to the character set in use; in this case you should be skeptical.  I would assume they refer to ASCII-X if they did not specifically mention the other (lowercase/uppercase) character set; if they did mention lower-case characters, I would infer the PETSCII set.
 
So here is a table listing the decimal and hexidecimal values of PETSCII, the character itself (Glyph), and the ASCII and Unicode equivalants, if they exist.  Some of the codes do not normally print a character, but peform an action.  These are shown under Glyph with a description and the reverse-font character that may appear in some circumstances (so-called quote mode and insert mode).  Otherwise, the glyph is only present if it has a Unicode value, although some browsers may not render them correctly (may appear as a blank, or square box, or ?).  There are also notes that describe the action of some codes, a keyboard combination to generate it, and/or a description of some characters.  There are some difference in the layouts of the CBM machines, but they are mostly equivalant.  The descriptions for keyboard shortcuts are based on the VIC-20/C64/C128.  I've also broken the table up into blocks to hopefully highlight the structure of this character set, although some things just seem to defy logic. 
 
Block 0, Low Control Codes
Code Glyph  ASCII Unicode Note(s)
Dec. Hex
0 00 @ null 0 NUL U+0000 key: Control+@
1 01 a nop     key: Control+A; ASCII SOH
2 02 b underline on (c128)     key: Control+B; ASCII STX
3 03 c nop     key: Control+C; ASCII ETX
4 04 d nop     key: Control+D; ASCII EOT
5 05 e white     key: Control+E; ASCII ENQ
6 06 f nop     key: Control+F; ASCII ACK
7 07 g bell 7 BEL   key: Control+G
8 08 h char lock on     key: Control+H; ASCII BS; Not C128: see code 11
9 09 i char lock off
tab (c128)
9 HT U+0009 key: Control+I, TAB; For C128 char-lock, see code 12
10 0A j line feed (C128) 10 LF U+000A key: Control+J; See also code 17
11 0B k char lock on (C128)     key: Control+K; ASCII VT
12 0C l char lock off (C128)     key: Control+L; ASCII FF
13 0D m carriage return 13 CR U+000D key: Control+M, Return, Enter; See also code 141
14 0E n go PETSCII     key: Control+N, Shift+C=; ASCII SO; See also code 142
15 0F o flash on (C128)     key: Control+O; ASCII SI; For C16 or Plus/4, see code 130
16 10 p nop     key: Control+P; ASCII DLE
17 11 q cursor down 10 LF U+000A key: Control+Q, CRSR ⇕, ⇩ ASCII DC1; See also 29, 145, 157
18 12 r reverse on     key: Control+R, Control+9; ASCII DC2
19 13 s home     key: Control+S, HOME; ASCII DC3
20 14 t delete 8 BS U+0008 key: Control+T, DEL; ASCII DC4
21 15 u nop     key: Control+U; ASCII NAK
22 16 v nop     key: Control+V; ASCII SYN
23 17 w nop     key: Control+W; ASCII ETB
24 18 x toggle Tab stop (C128)     key: Control+X, Shift+Tab; ASCII CAN
25 19 y nop     key: Control+Y; ASCII EM
26 1A z nop     key: Control+Z; ASCII SUB
27 1B [ escape (C128) 27 ESC U+001B key: Control+[, ESC
28 1C £ red     key: Control+3, Control+£; ASCII FS
29 1D ] cursor right     key: Control+], CRSR ⇔, ⇨; ASCII GS
30 1E green     key: Control+6, Control+↑; ASCII RS
31 1F blue     key: Control+7, Control+←; ASCII US
 
Block 1, Numbers and Punctuation
Code Glyph  ASCII Unicode Note(s)
Dec. Hex
32 20
32 SP U+0020 key: Spacebar
33 21 ! 33 U+0021 key: Shift+1
34 22 " 34 U+0022 key: Shift+2
35 23 # 35 U+0023 key: Shift+3
36 24 $ 36 U+0024 key: Shift+4
37 25 % 37 U+0025 key: Shift+5
38 26 & 38 U+0026 key: Shift+6
39 27 ' 39 U+0027 key: Shift+7
40 28 ( 40 U+0028 key: Shift+8
41 29 ) 41 U+0029 key: Shift+9
42 2A * 42 U+002A  
43 2B + 43 U+002B  
44 2C , 44 U+002C  
45 2D - 45 U+002D  
46 2E . 46 U+002E  
47 2F / 47 U+002F  
48 30 0 48 U+0030  
49 31 1 49 U+0031  
50 32 2 50 U+0032  
51 33 3 51 U+0033  
52 34 4 52 U+0034  
53 35 5 53 U+0035  
54 36 6 54 U+0036  
55 37 7 55 U+0037  
56 38 8 56 U+0038  
57 39 9 57 U+0039  
58 3A : 58 U+003A  
59 3B ; 59 U+003B  
60 3C < 60 U+003C key: Shift+,
61 3D = 61 U+003D  
62 3E > 62 U+003E key: Shift+.
63 3F ? 63 U+003F key: Shift+/
 
Block 2, Lowercase Letters
Code Glyph  ASCII Unicode Note(s)
Dec. Hex
64 40 @ 64 U+0040  
65 41 a 97 U+0061  
66 42 b 98 U+0062  
67 43 c 99 U+0063  
68 44 d 100 U+0064  
69 45 e 101 U+0065  
70 46 f 102 U+0066  
71 47 g 103 U+0067  
72 48 h 104 U+0068  
73 49 i 105 U+0069  
74 4A j 106 U+006A  
75 4B k 107 U+006B  
76 4C l 108 U+006C  
77 4D m 109 U+006D  
78 4E n 110 U+006E  
79 4F o 111 U+006F  
80 50 p 112 U+0070  
81 51 q 113 U+0071  
82 52 r 114 U+0072  
83 53 s 115 U+0073  
84 54 t 116 U+0074  
85 55 u 117 U+0075  
86 56 v 118 U+0076  
87 57 w 119 U+0077  
88 58 x 120 U+0078  
89 59 y 121 U+0079  
90 5A z 122 U+007A  
91 5B [ 91 U+005B key: Shift+:
92 5C £   U+00A3 ASCII \
93 5D ] 93 U+005D  
94 5E 94 U+2191 ASCII ^; On C16 and Plus/4, key: Shift+0
95 5F   U+2190 ASCII _
 
Block 3, Uppercase Letters (Alternate)
Code Glyph  ASCII Unicode Note(s)
Dec. Hex
96 60   U+2500 key: Shift+*; Horizontal bar at Y 5/8 (VIC-II/TED centered thick bar)
97 61 A 65 U+0041 key: Shift+A
98 62 B 66 U+0042 key: Shift+B
99 63 C 67 U+0043 key: Shift+C
100 64 D 68 U+0044 key: Shift+D
101 65 E 69 U+0045 key: Shift+E
102 66 F 70 U+0046 key: Shift+F
103 67 G 71 U+0047 key: Shift+G
104 68 H 72 U+0048 key: Shift+H
105 69 I 73 U+0049 key: Shift+I
106 6A J 74 U+004A key: Shift+J
107 6B K 75 U+004B key: Shift+K
108 6C L 76 U+004C key: Shift+L
109 6D M 77 U+004D key: Shift+M
110 6E N 78 U+004E key: Shift+N
111 6F O 79 U+004F key: Shift+O
112 70 P 80 U+0050 key: Shift+P
113 71 Q 81 U+0051 key: Shift+Q
114 72 R 82 U+0052 key: Shift+R
115 73 S 83 U+0053 key: Shift+S
116 74 T 84 U+0054 key: Shift+T
117 75 U 85 U+0055 key: Shift+U
118 76 V 86 U+0056 key: Shift+V
119 77 W 87 U+0057 key: Shift+W
120 78 X 88 U+0058 key: Shift+X
121 79 Y 89 U+0059 key: Shift+Y
122 7A Z 90 U+005A key: Shift+Z
123 7B   U+253C key: Shift++; Cross, similar to "+"
124 7C (left half)   U+25A6 (left half) key: C=+-; Diaganol cross-hatch (left half)
125 7D 124 U+2502 key: Shift+-; Vertical bar at X 5/8 (VIC-II/TED centered thick bar)
126 7E (not π)   reversed U+25A9 key: C=+^ or Shift+^; Reversed diaganol cross-hatch
127 7F   U+25A7 key: C=+*; Upper left to lower right fill
 
Block 4, High Control Codes
Code Glyph  ASCII Unicode Note(s)
Dec. Hex
128 80 nop     key: ???
129 81 A orange (most)
dark purple (VDC)
    key: C=+1
130 82 B underline off (c128)
flash on (Plus/4)
    key: Control+, (Plus/4)
131 83 C function 9     key: Shift+STOP
132 84 D function 10 (c128)
flash off (Plus/4)
    key: HELP (C128), Control+. (Plus/4)
133 85 E function 1     key: F1
134 86 F function 3     key: F3
135 87 G function 5     key: F5
136 88 H function 7     key: F7
137 89 I function 2     key: F2
138 8A J function 4     key: F4
139 8B K function 6     key: F6
140 8C L function 8     key: F8
141 8D M carriage return 13 CR U+000D key: Shift+Return (ignored by BASIC); See also code 13
142 8E N go ASCII-X     key: Shift+C=; See also code 14
143 8F O flash off (C128)     key: ???; For C16 or Plus/4, see 132
144 90 P black     key: Control+1
145 91 Q cursor up     key: Shift+CRSR ⇕, ⇧; See also 17, 29, 157
146 92 R reverse off     key: Control+0
147 93 S clear screen     key: Shift+HOME
148 94 T insert     key: Shift+DEL
149 95 U brown     key: C=+2
150 96 V light red     key: C=+3
151 97 W dark gray (VIC-II)
dark cyan (VDC)
    key: C=+4
152 98 X med. gray (VIC-II)
dark gray (VDC)
    key: C=+5
153 99 Y light green     key: C=+6
154 9A Z light blue     key: C=+7
155 9B light gray     key: C=+8
156 9C ? purple (magenta)     key: Control+5
157 9D cursor left     key: Shift+CRSR ⇔, ⇨; See also 17, 29, 145
158 9E yellow     key: Control+8
159 9F cyan     key: Control+4
 
Block 5, Common Graphics (Primary)
Code Glyph  ASCII Unicode Note(s)
Dec. Hex
160 A0   32 SP U+00A0 key: Shift+Spacebar; non-breaking space
161 A1   U+258C key: C=+K; right half block
162 A2   U+2584 key: C=+I; bottom half block
163 A3   U+2594 key: C=+T; top 1/8 block
164 A4   U+2581 key: C=+@; bottom 1/8 block
165 A5   U+258F key: C=+G; left 1/8 block (2/8 block on VIC-II and TED)
166 A6   U+25A9 key: C=++; diaganol cross-hatch
167 A7   U+2595 key: C=+M; right 1/8 block (2/8 block on VIC-II and TED)
168 A8 ?   U+??? key: C=+£; bottom half cross-hatch
169 A9 (not a triangle!)   U+25A8 key: Shift+£; lower left to upper right fill
170 AA   reverse U+258A key: C=+N; right 2/8 block (reverse Unicode left 6/8)
171 AB   U+251C key: C=+Q; East-pointing "T"
172 AC   U+2597 key: C=+D; bottom right block
173 AD   U+2514 key: C=+Z; corner up and right
174 AE   U+2510 key: C=+S; corner down and left
175 AF   U+2582 key: C=+P; bottom 2/8 block
176 B0   U+250C key: C=+A; corner down and right
177 B1   U+2534 key: C=+E; North-pointing "T"
178 B2   U+252C key: C=+R; South-pointing "T"
179 B3   U+2524 key: C=+W; West-pointing "T"
180 B4   U+258E key: C=+H; left 2/8 block
181 B5   U+258D key: C=+J; left 3/8 block
182 B6   reverse U+258B key: C=+L; right 3/8 block (reverse Unicode left 5/8)
183 B7   reverse U+2586 key: C=+Y; top 2/8 block (reverse Unicode bottom 6/8)
184 B8   reverse U+2585 key: C=+Y; top 3/8 block (reverse Unicode bottom 5/8)
185 B9   U+2583 key: C=+O; bottom 3/8 block
186 BA or   U+2713 or U+221A key: Shift+@; a check mark or square root
187 BB   U+2596 key: C=+F; bottom left block
188 BC   U+259D key: C=+C; top right block
189 BD   U+2518 key: C=+X; corner up and left
190 BE   U+2598 key: C=+V; top left block
191 BF   U+259A key: C=+B; top left and bottom right blocks
 
Block 6, Uppercase Letters (Primary)
Code Glyph  ASCII Unicode Note(s)
Dec. Hex
192 C0   U+2500 key: Shift+*; Horizontal bar at Y 5/8 (VIC-II/TED centered thick bar)
193 C1 A 65 U+0041 key: Shift+A
194 C2 B 66 U+0042 key: Shift+B
195 C3 C 67 U+0043 key: Shift+C
196 C4 D 68 U+0044 key: Shift+D
197 C5 E 69 U+0045 key: Shift+E
198 C6 F 70 U+0046 key: Shift+F
199 C7 G 71 U+0047 key: Shift+G
200 C8 H 72 U+0048 key: Shift+H
201 C9 I 73 U+0049 key: Shift+I
202 CA J 74 U+004A key: Shift+J
203 CB K 75 U+004B key: Shift+K
204 CC L 76 U+004C key: Shift+L
205 CD M 77 U+004D key: Shift+M
206 CE N 78 U+004E key: Shift+N
207 CF O 79 U+004F key: Shift+O
208 D0 P 80 U+0050 key: Shift+P
209 D1 Q 81 U+0051 key: Shift+Q
210 D2 R 82 U+0052 key: Shift+R
211 D3 S 83 U+0053 key: Shift+S
212 D4 T 84 U+0054 key: Shift+T
213 D5 U 85 U+0055 key: Shift+U
214 D6 V 86 U+0056 key: Shift+V
215 D7 W 87 U+0057 key: Shift+W
216 D8 X 88 U+0058 key: Shift+X
217 D9 Y 89 U+0059 key: Shift+Y
218 DA Z 90 U+005A key: Shift+Z
219 DB   U+253C key: Shift++; Cross, similar to "+"
220 DC (left half)   U+25A6 (left half) key: C=+-; Diaganol cross-hatch (left half)
221 DD 124 U+2502 key: Shift+-; Vertical bar at X 5/8 (VIC-II/TED centered thick bar)
222 DE (not π)   reversed U+25A9 key: C=+^ or Shift+^; Reversed diaganol cross-hatch
223 DF (not a triangle!)   U+25A7 key: C=+*; Upper left to lower right fill
 
Block 7, Common Graphics (Alternate)
Code Glyph  ASCII Unicode Note(s)
Dec. Hex
224 E0   32 SP U+00A0 key: Shift+Spacebar; non-breaking space
225 E1   U+258C key: C=+K; right half block
226 E2   U+2584 key: C=+I; bottom half block
227 E3   U+2594 key: C=+T; top 1/8 block
228 E4   U+2581 key: C=+@; bottom 1/8 block
229 E5   U+258F key: C=+G; left 1/8 block (2/8 block on VIC-II and TED)
230 E6   U+25A9 key: C=++; diaganol cross-hatch
231 E7   U+2595 key: C=+M; right 1/8 block (2/8 block on VIC-II and TED)
232 E8 ?   U+??? key: C=+£; bottom half cross-hatch
233 E9 (not a triangle!)   U+25A8 key: Shift+£; lower left to upper right fill
234 EA   reverse U+258A key: C=+N; right 2/8 block (reverse Unicode left 6/8)
235 EB   U+251C key: C=+Q; East-pointing "T"
236 EC   U+2597 key: C=+D; bottom right block
237 ED   U+2514 key: C=+Z; corner up and right
238 EE   U+2510 key: C=+S; corner down and left
239 EF   U+2582 key: C=+P; bottom 2/8 block
240 F0   U+250C key: C=+A; corner down and right
241 F1   U+2534 key: C=+E; North-pointing "T"
242 F2   U+252C key: C=+R; South-pointing "T"
243 F3   U+2524 key: C=+W; West-pointing "T"
244 F4   U+258E key: C=+H; left 2/8 block
245 F5   U+258D key: C=+J; left 3/8 block
246 F6   reverse U+258B key: C=+L; right 3/8 block (reverse Unicode left 5/8)
247 F7   reverse U+2586 key: C=+Y; top 2/8 block (reverse Unicode bottom 6/8)
248 F8   reverse U+2585 key: C=+Y; top 3/8 block (reverse Unicode bottom 5/8)
249 F9   U+2583 key: C=+O; bottom 3/8 block
250 FA or   U+2713 or U+221A key: Shift+@; a check mark or square root
251 FB   U+2596 key: C=+F; bottom left block
252 FC   U+259D key: C=+C; top right block
253 FD   U+2518 key: C=+X; corner up and left
254 FE   U+2598 key: C=+V; top left block
255 FF (not π nor ▚)   reversed U+25A9 key: C=+^ or Shift+^; Reversed diaganol cross-hatch
 

© H2Obsession, 2014, 2015, 2016
Comments