PETSCII Codes in Listings

From C64-Wiki
Jump to navigationJump to search

Type-in listings in BASIC were very popular in the early days of home computers and gave newcomers a good starting point to discover how their computer work.

Printing such BASIC listings for the Commodore computers however was not an easy task because of the specific looking PETSCII-characters. To overcome that problem descriptive codes were introduced to represent these characters as plain text.

PETSCII Plain Text Representation in BASIC Listings[edit | edit source]

The following table provides a complete overview of the 256 PETSCII CHR$-codes and their text representation by the most common PRG-to-ASCII tools/de-tokenizers. Also it shows the keys, key combinations or tricks, how these PETSCII-characters can be entered as part of a string sequence.

PEEK/POKE
(dec, hex)
CHR$/ASC
(dec, hex)
BASTEXT
(V1.0)
PETCAT
(VICE3.3)
C64List
(V3.51)
Screen Control Description
(click to sort by most common)
How to enter
on C64 keyboard
How to enter
on PC keyboard
128/$80 000/$00 {null} {null} {null} @ + #RRT @ + #RRT
129/$81 001/$01 {ct a} {CTRL-A} {$01} ctrl + a  tab + a 
130/$82 002/$02 {ct b} {CTRL-B} {$02} ctrl + b  tab + b 
131/$83 003/$03 {ct c} {stop} {stop} Value of run/stop key ctrl + c  tab + c 
132/$84 004/$04 {ct d} {CTRL-D} {$04} ctrl + d  tab + d 
133/$85 005/$05 {white} {wht} {white} Set text color to white (1) ctrl + 2  tab + 2 
134/$86 006/$06 {ct f} {CTRL-F} {$06} ctrl + f  tab + f 
135/$87 007/$07 {ct g} {CTRL-G} {$07} ctrl + g  tab + g 
136/$88 008/$08 {ct h} {dish} {altdis} Disable Shift + C= ctrl + h  tab + h 
137/$89 009/$09 {ct i} {ensh} {altena} Enable Shift + C= ctrl + i  tab + i 
138/$8A 010/$0A {ct j} {$0a} {$0a} ctrl + j  tab + j 
139/$8B 011/$0B {ct k} {CTRL-K} {$0b} ctrl + k  tab + k 
140/$8C 012/$0C {ct l} {\f} {$0c} Form feed (on printer) ctrl + l  tab + l 
141/$8D 013/$0D {return} {\n} {$0d} Press return m + #RRT m + #RRT
142/$8E 014/$0E {ct n} {swlc} {lower} Switch text on screen to lower case ctrl + n  tab + n 
143/$8F 015/$0F {ct o} {CTRL-O} {$0f} ctrl + o  tab + o 
144/$90 016/$10 {ct p} {CTRL-P} {$10} ctrl + p  tab + p 
145/$91 017/$11 {down} {down} {down} Move cursor 1 position down crsr ⇵   
146/$92 018/$12 {reverse on} {rvon} {rvrs on} Turn reverse on ctrl + 9  tab + 9 
147/$93 019/$13 {home} {home} {home} Place cursor in top left corner CLR/HOME  Home 
148/$94 020/$14 {delete} {del} {backspace} Delete character before cursor position t + #RRT t + #RRT
149/$95 021/$15 {ct u} {CTRL-U} {$15} ctrl + u  tab + u 
150/$96 022/$16 {ct v} {CTRL-V} {$16} ctrl + v  tab + v 
151/$97 023/$17 {ct w} {CTRL-W} {$17} ctrl + w  tab + w 
152/$98 024/$18 {ct x} {CTRL-X} {$18} ctrl + x  tab + x 
153/$99 025/$19 {ct y} {CTRL-Y} {$19} ctrl + y  tab + y 
154/$9A 026/$1A {ct z} {CTRL-Z} {$1a} ctrl + z  tab + z 
155/$9B 027/$1B {027} {esc} {$1b} [ + #RRT [ + #RRT
156/$9C 028/$1C {red} {red} {red} Set text color to red (2) ctrl + 3  tab + 3 
157/$9D 029/$1D {right} {rght} {right} Move cursor 1 position to the right CRSR ⇆   
158/$9E 030/$1E {green} {grn} {green} Set text color to green (5) ctrl + 6  tab + 6 
159/$9F 031/$1F {blue} {blu} {blue} Set text color to blue (6) ctrl + 7  tab + 7 
032/$20 032/$20 {space} {space} {space} Print space character space  space 
033/$21 033/$21 ! ! !
034/$22 034/$22 " " "
035/$23 035/$23 # # #
036/$24 036/$24 $ $ $
037/$25 037/$25 % % %
038/$26 038/$26 & & &
039/$27 039/$27 ' ' '
040/$28 040/$28 ( ( (
041/$29 041/$29 ) ) )
042/$2A 042/$2A * * *
043/$2B 043/$2B + + +
044/$2C 044/$2C , , ,
045/$2D 045/$2D - - -
046/$2E 046/$2E . . .
047/$2F 047/$2F / / /
048/$30 048/$30 0 0 0
049/$31 049/$31 1 1 1
050/$32 050/$32 2 2 2
051/$33 051/$33 3 3 3
052/$34 052/$34 4 4 4
053/$35 053/$35 5 5 5
054/$36 054/$36 6 6 6
055/$37 055/$37 7 7 7
056/$38 056/$38 8 8 8
057/$39 057/$39 9 9 9
058/$3A 058/$3A : : :
059/$3B 059/$3B ; ; ;
060/$3C 060/$3C < < <
061/$3D 061/$3D = = =
062/$3E 062/$3E > > >
063/$3F 063/$3F ? ? ?
000/$00 064/$40 @ @ @
001/$01 065/$41 a a a
002/$02 066/$42 b b b
003/$03 067/$43 c c c
004/$04 068/$44 d d d
005/$05 069/$45 e e e
006/$06 070/$46 f f f
007/$07 071/$47 g g g
008/$08 072/$48 h h h
009/$09 073/$49 i i i
010/$0A 074/$4A j j j
011/$0B 075/$4B k k k
012/$0C 076/$4C l l l
013/$0D 077/$4D m m m
014/$0E 078/$4E n n n
015/$0F 079/$4F o o o
016/$10 080/$50 p p p
017/$11 081/$51 q q q
018/$12 082/$52 r r r
019/$13 083/$53 s s s
020/$14 084/$54 t t t
021/$15 085/$55 u u u
022/$16 086/$56 v v v
023/$17 087/$57 w w w
024/$18 088/$58 x x x
025/$19 089/$59 y y y
026/$1A 090/$5A z z z
027/$1B 091/$5B [ [ [
028/$1C 092/$5C {pound} \ {pound} £  insert 
029/$1D 093/$5D ] ] ]
030/$1E 094/$5E ^ ^ {up arrow}   delete 
031/$1F 095/$5F {arrow left} _ {back arrow}   § 
064/$40 096/$60 {096} {$60} {$60} Duplicate - use CHR$(#192) instead
065/$41 097/$61 {097} {$61} {$61} Duplicate - use CHR$(#193) instead
066/$42 098/$62 {098} {$62} {$62} Duplicate - use CHR$(#194) instead
067/$43 099/$63 {099} {$63} {$63} Duplicate - use CHR$(#195) instead
068/$44 100/$64 {100} {$64} {$64} Duplicate - use CHR$(#196) instead
069/$45 101/$65 {101} {$65} {$65} Duplicate - use CHR$(#197) instead
070/$46 102/$66 {102} {$66} {$66} Duplicate - use CHR$(#198) instead
071/$47 103/$67 {103} {$67} {$67} Duplicate - use CHR$(#199) instead
072/$48 104/$68 {104} {$68} {$68} Duplicate - use CHR$(#200) instead
073/$49 105/$69 {105} {$69} {$69} Duplicate - use CHR$(#201) instead
074/$4A 106/$6A {106} {$6a} {$6a} Duplicate - use CHR$(#202) instead
075/$4B 107/$6B {107} {$6b} {$6b} Duplicate - use CHR$(#203) instead
076/$4C 108/$6C {108} {$6c} {$6c} Duplicate - use CHR$(#204) instead
077/$4D 109/$6D {109} {$6d} {$6d} Duplicate - use CHR$(#205) instead
078/$4E 110/$6E {110} {$6e} {$6e} Duplicate - use CHR$(#206) instead
079/$4F 111/$6F {111} {$6f} {$6f} Duplicate - use CHR$(#207) instead
080/$50 112/$70 {112} {$70} {$70} Duplicate - use CHR$(#208) instead
081/$51 113/$71 {113} {$71} {$71} Duplicate - use CHR$(#209) instead
082/$52 114/$72 {114} {$72} {$72} Duplicate - use CHR$(#210) instead
083/$53 115/$73 {115} {$73} {$73} Duplicate - use CHR$(#211) instead
084/$54 116/$74 {116} {$74} {$74} Duplicate - use CHR$(#212) instead
085/$55 117/$75 {117} {$75} {$75} Duplicate - use CHR$(#213) instead
086/$56 118/$76 {118} {$76} {$76} Duplicate - use CHR$(#214) instead
087/$57 119/$77 {119} {$77} {$77} Duplicate - use CHR$(#215) instead
088/$58 120/$78 {120} {$78} {$78} Duplicate - use CHR$(#216) instead
089/$59 121/$79 {121} {$79} {$79} Duplicate - use CHR$(#217) instead
090/$5A 122/$7A {122} {$7a} {$7a} Duplicate - use CHR$(#218) instead
091/$5B 123/$7B {123} {$7b} {$7b} Duplicate - use CHR$(#219) instead
092/$5C 124/$7C {124} {$7c} {$7c} Duplicate - use CHR$(#220) instead
093/$5D 125/$7D | {$7d} {$7d} Duplicate - use CHR$(#221) instead
094/$5E 126/$7E {126} {$7e} {$7e} Duplicate - use CHR$(#222) instead
095/$5F 127/$7F {127} {$7f} {$7f} Duplicate - use CHR$(#223) instead
195/$C3 128/$80 {128} {$80} {$80}
193/$C1 129/$81 {orange} {orng} {orange} Set text color to orange (8) C= + 1  ctrl + 1 
194/$C2 130/$82 {130} {$82} {$82}
195/$C3 131/$83 {131} {$83} {$83}
196/$C4 132/$84 {132} {$84} {$84}
197/$C5 133/$85 {f1} {f1} {f1} Function Key F1 f1  f1 
198/$C6 134/$86 {f3} {f3} {f3} Function Key F3 f3  f3 
199/$C7 135/$87 {f5} {f5} {f5} Function Key F5 f5  f5 
200/$C8 136/$88 {f7} {f7} {f7} Function Key F7 f7  f7 
201/$C9 137/$89 {f2} {f2} {f2} Function Key F2 shift + f1  f2 
202/$CA 138/$8A {f4} {f4} {f4} Function Key F4 shift + f3  f4 
203/$CB 139/$8B {f6} {f6} {f6} Function Key F6 shift + f5  f6 
204/$CC 140/$8C {f8} {f8} {f8} Function Key F8 shift + f7  f8 
205/$CD 141/$8D {141} {stret} {shft ret} Shift return shift + m + #RRT shift + m + #RRT
206/$CE 142/$8E {142} {swuc} {upper} Switch text on screen to upper case shift + n + #RRT shift + n + #RRT
207/$CF 143/$8F {143} {$8f} {$8f}
208/$D0 144/$90 {black} {blk} {black} Set text color to black (0) ctrl + 1  tab + 1 
209/$D1 145/$91 {up} {up} {up} Move cursor 1 position up shift + crsr ⇅   
210/$D2 146/$92 {reverse off} {rvof} {rvrs off} Turn reverse off ctrl + 0  tab + 0 
211/$D3 147/$93 {clear} {clr} {clear} Clear text on screen and place cursor in top left corner shift + clr/home  shift + Home 
212/$D4 148/$94 {148} {inst} {insert} Insert an empty space at cursor position shift + inst/del  shift + backspace 
213/$D5 149/$95 {brown} {brn} {brown} Set text color to brown (9) C= + 2  ctrl + 2 
214/$D6 150/$96 {pink} {lred} {lt. red} Set text color to light red (10) C= + 3  ctrl + 3 
215/$D7 151/$97 {dark gray} {gry1} {gray1} Set text color to grey 1 (11) C= + 4  ctrl + 4 
216/$D8 152/$98 {gray} {gry2} {gray2} Set text color to grey 2 (12) C= + 5  ctrl + 5 
217/$D9 153/$99 {light green} {lgrn} {lt. green} Set text color to light green (13) C= + 6  ctrl + 6 
218/$DA 154/$9A {light blue} {lblu} {lt. blue} Set text color to light blue (14) C= + 7  ctrl + 7 
219/$DB 155/$9B {light gray} {gry3} {gray3} Set text color to grey 3 (15) C= + 8  ctrl + 8 
220/$DC 156/$9C {purple} {pur} {purple} Set text color to purple (4) ctrl + 5  tab + 5 
221/$DD 157/$9D {left} {left} {left} Move cursor 1 position to the left shift + crsr ⇄   
222/$DE 158/$9E {yellow} {yel} {yellow} Set text color to yellow (7) ctrl + 8  tab + 8 
223/$DF 159/$9F {cyan} {cyn} {cyan} Set text color to cyan (3) ctrl + 4  tab + 4 
032/$20 160/$A0 {sh space} {$a0} {$a0} Shift space shift + space  shift + space 
097/$61 161/$A1 {cm k} {CBM-K} {$a1} C= + k  ctrl + k 
098/$62 162/$A2 {cm i} {CBM-I} {$a2} C= + i  ctrl + i 
099/$63 163/$A3 {cm t} {CBM-T} {$a3} C= + t  ctrl + t 
100/$64 164/$A4 {cm @} {CBM-@} {$a4} C= + @  ctrl + [ 
101/$65 165/$A5 {cm g} {CBM-G} {$a5} C= + g  ctrl + g 
102/$66 166/$A6 {cm +} {CBM-+} {$a6} C= + +  ctrl + ' 
103/$67 167/$A7 {cm m} {CBM-M} {$a7} C= + m  ctrl + m 
104/$68 168/$A8 {cm pound} {CBM-POUND} {shft pound} C= + £  ctrl + insert 
105/$69 169/$A9 {sh pound} {SHIFT-POUND} {ctrl pound} shift + £  shift + insert 
106/$6A 170/$AA {cm n} {CBM-N} {$aa} C= + n  ctrl + n 
107/$6B 171/$AB {cm q} {CBM-Q} {$ab} C= + q  ctrl + q 
108/$6C 172/$AC {cm d} {CBM-D} {$ac} C= + d  ctrl + d 
109/$6D 173/$AD {cm z} {CBM-Z} {$ad} C= + z  ctrl + z 
110/$6E 174/$AE {cm s} {CBM-S} {$ae} C= + s  ctrl + s 
111/$6F 175/$AF {cm p} {CBM-P} {$af} C= + p  ctrl + p 
112/$70 176/$B0 {cm a} {CBM-A} {$b0} C= + a  ctrl + a 
113/$71 177/$B1 {cm e} {CBM-E} {$b1} C= + e  ctrl + e 
114/$72 178/$B2 {cm r} {CBM-R} {$b2} C= + r  ctrl + r 
115/$73 179/$B3 {cm w} {CBM-W} {$b3} C= + w  ctrl + w 
116/$74 180/$B4 {cm h} {CBM-H} {$b4} C= + h  ctrl + h 
117/$75 181/$B5 {cm j} {CBM-J} {$b5} C= + j  ctrl + j 
118/$76 182/$B6 {cm l} {CBM-L} {$b6} C= + l  ctrl + l 
119/$77 183/$B7 {cm y} {CBM-Y} {$b7} C= + y  ctrl + y 
120/$78 184/$B8 {cm u} {CBM-U} {$b8} C= + u  ctrl + u 
121/$79 185/$B9 {cm o} {CBM-O} {$b9} C= + o  ctrl + o 
122/$7A 186/$BA {sh @} {SHIFT-@} {$ba} shift + @  shift + ü 
123/$7B 187/$BB {cm f} {CBM-F} {$bb} C= + f  ctrl + f 
124/$7C 188/$BC {cm c} {CBM-C} {$bc} C= + c  ctrl + c 
125/$7D 189/$BD {cm x} {CBM-X} {$bd} C= + x  ctrl + x 
126/$7E 190/$BE {cm v} {CBM-V} {$be} C= + v  ctrl + v 
127/$7F 191/$BF {cm b} {CBM-B} {$bf} C= + b  ctrl + b 
064/$40 192/$C0 {sh asterisk} {SHIFT-*} {$c0} shift + *  shift + ¨ 
065/$41 193/$C1 A A A shift + a  shift + a 
066/$42 194/$C2 B B B shift + b  shift + b 
067/$43 195/$C3 C C C shift + c  shift + c 
068/$44 196/$C4 D D D shift + d  shift + d 
069/$45 197/$C5 E E E shift + e  shift + e 
070/$46 198/$C6 F F F shift + f  shift + f 
071/$47 199/$C7 G G G shift + g  shift + g 
072/$48 200/$C8 H H H shift + h  shift + h 
073/$49 201/$C9 I I I shift + i  shift + i 
074/$4A 202/$CA J J J shift + j  shift + j 
075/$4B 203/$CB K K K shift + k  shift + k 
076/$4C 204/$CC L L L shift + l  shift + l 
077/$4D 205/$CD M M M shift + m  shift + m 
078/$4E 206/$CE N N N shift + n  shift + n 
079/$4F 207/$CF O O O shift + o  shift + o 
080/$50 208/$D0 P P P shift + p  shift + p 
081/$51 209/$D1 Q Q Q shift + q  shift + q 
082/$52 210/$D2 R R R shift + r  shift + r 
083/$53 211/$D3 S S S shift + s  shift + s 
084/$54 212/$D4 T T T shift + t  shift + t 
085/$55 213/$D5 U U U shift + u  shift + u 
086/$56 214/$D6 V V V shift + v  shift + v 
087/$57 215/$D7 W W W shift + w  shift + w 
088/$58 216/$D8 X X X shift + x  shift + x 
089/$59 217/$D9 Y Y Y shift + y  shift + y 
090/$5A 218/$DA Z Z Z shift + z  shift + z 
091/$5B 219/$DB {sh +} {SHIFT-+} {$db} shift + +  shift + ' 
092/$5C 220/$DC {cm -} {CBM--} {$dc} C= + -  ctrl + ^ 
093/$5D 221/$DD {sh -} {SHIFT--} {$dd} shift + -  shift + ^ 
094/$5E 222/$DE {222} {$de} {$de}
095/$5F 223/$DF {cm asterisk} {CBM-*} {$df} C= + *  ctrl + ] 
096/$60 224/$E0 {224} {$e0} {$e0} Duplicate - use CHR$(#160) instead
097/$61 225/$E1 {225} {$e1} {$e1} Duplicate - use CHR$(#161) instead
098/$62 226/$E2 {226} {$e2} {$e2} Duplicate - use CHR$(#162) instead
099/$63 227/$E3 {227} {$e3} {$e3} Duplicate - use CHR$(#163) instead
100/$64 228/$E4 {228} {$e4} {$e4} Duplicate - use CHR$(#164) instead
101/$65 229/$E5 {229} {$e5} {$e5} Duplicate - use CHR$(#165) instead
102/$66 230/$E6 {230} {$e6} {$e6} Duplicate - use CHR$(#166) instead
103/$67 231/$E7 {231} {$e7} {$e7} Duplicate - use CHR$(#167) instead
104/$68 232/$E8 {232} {$e8} {$e8} Duplicate - use CHR$(#168) instead
105/$69 233/$E9 {233} {$e9} {$e9} Duplicate - use CHR$(#169) instead
106/$6A 234/$EA {234} {$ea} {$ea} Duplicate - use CHR$(#170) instead
107/$6B 235/$EB {235} {$eb} {$eb} Duplicate - use CHR$(#171) instead
108/$6C 236/$EC {236} {$ec} {$ec} Duplicate - use CHR$(#172) instead
109/$6D 237/$ED {237} {$ed} {$ed} Duplicate - use CHR$(#173) instead
110/$6E 238/$EE {238} {$ee} {$ee} Duplicate - use CHR$(#174) instead
111/$6F 239/$EF {239} {$ef} {$ef} Duplicate - use CHR$(#175) instead
112/$70 240/$F0 {240} {$f0} {$f0} Duplicate - use CHR$(#176) instead
113/$71 241/$F1 {241} {$f1} {$f1} Duplicate - use CHR$(#177) instead
114/$72 242/$F2 {242} {$f2} {$f2} Duplicate - use CHR$(#178) instead
115/$73 243/$F3 {243} {$f3} {$f3} Duplicate - use CHR$(#179) instead
116/$74 244/$F4 {244} {$f4} {$f4} Duplicate - use CHR$(#180) instead
117/$75 245/$F5 {245} {$f5} {$f5} Duplicate - use CHR$(#181) instead
118/$76 246/$F6 {246} {$f6} {$f6} Duplicate - use CHR$(#182) instead
119/$77 247/$F7 {247} {$f7} {$f7} Duplicate - use CHR$(#183) instead
120/$78 248/$F8 {248} {$f8} {$f8} Duplicate - use CHR$(#184) instead
121/$79 249/$F9 {249} {$f9} {$f9} Duplicate - use CHR$(#185) instead
122/$7A 250/$FA {250} {$fa} {$fa} Duplicate - use CHR$(#186) instead
123/$7B 251/$FB {251} {$fb} {$fb} Duplicate - use CHR$(#187) instead
124/$7C 252/$FC {252} {$fc} {$fc} Duplicate - use CHR$(#188) instead
125/$7D 253/$FD {253} {$fd} {$fd} Duplicate - use CHR$(#189) instead
126/$7E 254/$FE {254} {$fe} {$fe} Duplicate - use CHR$(#190) instead
094/$5E 255/$FF {pi} ~ {$ff} shift +   shift + delete 

Small oddity with the Pi-Symbol when entering as shift +  :

  • A$="𝜋":PRINTASC(A$) will show the Pi character as value 255
  • GETA$:PRINTASC(A$) will show the Pi character as value 222


Return-Reverse-Trick (RRT)[edit | edit source]

Unfortunately some control characters cannot be entered directly inside a string. Instead we use a little workaround to overcome this limitation.

  1. Enter the complete BASIC line but instead of the control-character (e.g. inverse 't' for delete) just set a 't' for the moment and press return .
  2. Move the cursor back up to the place where the inverse 't' should be.
  3. Turn on reverse mode by applying ctrl + 9 , overwrite the 't' by typing again 't' in reverse mode and press return again.

When you list the entered line you should be able to see that the BASIC editor has accepted this later change. ‎