PETSCII

PETSCII (PET Standard Code of Information Interchange), also known as CBM ASCII, is the character set used in Commodore Business Machines (CBM)'s 8-bit home computers, starting with the PET from 1977 and including the C16, C64, C116, C128, CBM-II, Plus/4, and VIC-20.

PETSCII
PETSCII (shifted and unshifted)
Language(s)English with pseudographics
Classification8-bit extended early ASCII
Based onUS-ASCII (1963 version)

History

The character set was largely designed by Leonard Tramiel (the son of Commodore CEO Jack Tramiel) and PET designer Chuck Peddle. The graphic characters of PETSCII were one of the extensions Commodore specified for Commodore BASIC when laying out desired changes to Microsoft's existing 6502 BASIC to Microsoft's Ric Weiland in 1977.[1] The VIC-20 used the same pixel-for-pixel font as the PET, although the characters appeared wider due to the VIC's 22-column screen. The Commodore 64, however, used a slightly re-designed, heavy upper-case font, essentially a thicker version of the PET's, in order to avoid color artifacts created by the machine's higher resolution screen. The C64's lowercase characters are identical to the lowercase characters in the Atari 800's system font (released several years earlier).

Peddle claims the inclusion of card suit symbols was spurred by the demand that it should be easy to write card games on the PET (as part of the specification list he received).

Specifications

C64 startup screen with shifted and unshifted modes of PETSCII, and the two characters from ASCII-1963
PETSCII Chart as displayed on the C64 in shifted and unshifted modes. (Not shown are control codes, as well as characters in the $C0–$FF range, which are the standard uppercase keycodes returned from the keyboard, and which are mirrored to the range $60–$7F.)

PETSCII is based on the 1963 version of ASCII (rather than the 1967 version, which most if not all other computer character sets based on ASCII use). Assuming the graphics mode is unshifted, PETSCII has only uppercase letters in its powerup state, an up-arrow (  ) instead of a caret ( ^ ) in position $5E and a left-arrow (  ) instead of an underscore ( _ ) in position $5F, these two variants are common in ASCII-1963.[2] Also, in the VIC-20 and C64 version, the backslash ( \ ) in position $5C is occupied by a British pound sign ( £ ) (preceding the usage of the same ASCII code by the Japanese and Korean versions of ISO 646 for their respective currency symbols). In unshifted mode, codes $60$7F and $A0$FF are allotted to CBM-specific block graphics characters (horizontal and vertical lines, hatches, shades, triangles, circles and card suits). Ranges $00$1F and $80$9F have control codes.

The Commodore PET's lack of a programmable bitmap-mode for computer graphics, as well as it having no redefinable character set capability, may be one of the reasons PETSCII was developed; by creatively using the well thought-out block graphics, a higher degree of sophistication in screen graphics is attainable than by using plain ASCII's letter/digit/punctuation characters. In addition to the relatively diverse set of geometrical shapes that can thus be produced, PETSCII allows for several grayscale levels by its provision of differently hatched checkerboard squares/half-squares. Finally, the reverse-video mode (see below) is used to complete the range of graphics characters, in that it provides mirrored half-square blocks.

PETSCII also has a text mode, in which lowercase letters occupy the range $41$5A, and uppercase letters occupy the range $C1$DA. The mode is toggled by holding one of the SHIFT keys and then pressing and releasing the Commodore key. Regardless of whether the chip has undergone this graphic "shift", there are block graphic characters in the range of $E0-FF. This serves to distinguish PETSCII from those kinds of ASCII that go back no farther than ASCII-1967, so any text transfer between an 8-bit Commodore machine and one that uses 1967-derived ASCII would result in text where uppercase letters appear to be lowercase, and lowercase letters uppercase. There is no easy Boolean operation to change these cases to the proper case. Thus, as with other computers based on non-standard-ASCII character sets, software conversion is needed when exchanging text files and/or telecommunicating with standard ASCII systems. The other ranges are unchanged in shifted mode; this means that the other characters added in ASCII-1967 besides lowercase letters  i.e. the grave accent, curly braces, vertical bar, and tilde  do not exist in PETSCII.

Included in PETSCII are cursor and screen control codes, such as {HOME}, {CLR}, {RVS ON}, and {RVS OFF} (the latter two activating/deactivating reverse-video character display). The control codes appeared in program listings as reverse-video graphic characters, although some computer magazines, in their efforts to provide more clearly readable listings, pretty-printed the codes using their actual names, like the above examples. Such names were commonly enclosed in curly braces in the listings. This prevented ambiguity, since, as mentioned, PETSCII had no curly brace characters. The screen control codes were essentially similar to escape codes for text based computer terminals.

As indicated above, PETSCII provides for shifting between the power-on default (unshifted) uppercase+graphics character set and the alternative (shifted) lower+uppercase set (where the shifted set contains a subset of the block graphic characters of the unshifted set). The shift between modes is done by POKEing location 59468 with the value 14 to select the alternative set or 12 to revert to standard. On C64 the sets are alternated by flipping bit 2 of the byte 53272. On some models of PET this can also be achieved via special control code PRINT CHR$(14) which adjust the line spacing as well as changing the character set; the POKE method is still available and does not alter the line spacing.[3] Thus, screen editor state changes, rather than the employment of separate ASCII codes, are used to choose between single-case (all capitals) and dual case. In the VIC-20, C64, and later machines (not including the CBM business computers), color codes supplement the other screen control codes. (The colors of the VIC-20 and C64/128 are listed in the VIC-II article.)

Character set

Not all of the characters encoded by PETSCII are 'graphic' and not all of them have a corresponding Unicode representation. The following table shows for PETSCII characters the corresponding Unicode character and code point. Control characters and other non-printing characters are represented by their names. Where a particular code point encodes both a shifted and unshifted character, both characters are shown, with the unshifted character on the left and the shifted character on the right. Row and column headings indicate the hexadecimal digit combinations to produce the eight-bit code value; e.g., the letter L is at code value $4C.

Note that the table below is for the Commodore 64, Commodore 16, and Commodore 128. Control characters differ between these machines and are presented in separate tables. Other Commodore machines used slightly different versions of PETSCII, which used different control characters and in some cases different graphic characters. For example, on CBM machines prior to the VIC-20, characters $2C and $6C both produced a comma character, albeit with slightly different semantics.[4]

The actual character generator ROM used a different set of assignments. For example, to display the characters "@ABC" on screen by directly writing into the screen memory, one would POKE the decimal values 0, 1, 2, and 3 rather than 64, 65, 66, and 67.[5]

PETSCII (Commodore 64, 16, and 128)[6][7][8][9]
_0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _A _B _C _D _E _F
0_
0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1_
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2_
32
SP
0020
!
0021
"
0022
#
0023
$
0024
%
0025
&
0026
'
0027
(
0028
)
0029
*
002A
+
002B
,
002C
-
002D
.
002E
/
002F
3_
48
0
0030
1
0031
2
0032
3
0033
4
0034
5
0035
6
0036
7
0037
8
0038
9
0039
:
003A
;
003B
<
003C
=
003D
>
003E
?
003F
4_
64
@
0040
A a
0041 0061
B b
0042 0062
C c
0043 0063
D d
0044 0064
E e
0045 0065
F f
0046 0066
G g
0047 0067
H h
0048 0068
I i
0049 0069
J j
004A 006A
K k
004B 006B
L l
004C 006C
M m
004D 006D
N n
004E 006E
O o
004F 006F
5_
80
P p
0050 0070
Q q
0051 0071
R r
0052 0072
S s
0053 0073
T t
0054 0074
U u
0055 0075
V v
0056 0076
W w
0057 0077
X x
0058 0078
Y y
0059 0079
Z z
005A 007A
[
005B
£
00A3
]
005D

2191

2190
6_
96
🭹
1FB79
A
2660 0041
🭲 B
1FB72 0042
🭸 C
1FB78 0043
🭷 D
1FB77 0044
🭶 E
1FB76 0045
🭺 F
1FB7A 0046
🭱 G
1FB71 0047
🭴 H
1FB74 0048
I
256E 0049
J
2570 004A
K
256F 004B
🭼 L
1FB7C 004C
M
2572 004D
N
2571 004E
🭽 O
1FB7D 004F
7_
112
🭾 P
1FB7E 0050
Q
25CF 0051
🭻 R
1FB7B 0052
S
2665 0053
🭰 T
1FB70 0054
U
256D 0055
V
2573 0056
W
25CB 0057
X
2663 0058
🭵 Y
1FB75 0059
Z
2666 005A

253C
🮌
1FB8C

2502
π 🮖
03C0 1FB96
◥ 🮘
25E5 1FB98
8_
128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9_
144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
A_
160
NBSP
00A0

258C

2584

2594

2581

258F

2592

2595
🮏
1FB8F
◤ 🮙
25E4 1FB99
🮇
1FB87

251C

2597

2514

2510

2582
B_
176

250C

2534

252C

2524

258E

258D
🮈
1FB88
🮂
1FB82
🮃
1FB83

2583
🭿 ✓
1FB7F 2713

2596

259D

2518

2598

259A
C_
192
🭹
1FB79
A
2660 0041
🭲 B
1FB72 0042
🭸 C
1FB78 0043
🭷 D
1FB77 0044
🭶 E
1FB76 0045
🭺 F
1FB7A 0046
🭱 G
1FB71 0047
🭴 H
1FB74 0048
I
256E 0049
J
2570 004A
K
256F 004B
🭼 L
1FB7C 004C
M
2572 004D
N
2571 004E
🭽 O
1FB7D 004F
D_
208
🭾 P
1FB7E 0050
Q
25CF 0051
🭻 R
1FB7B 0052
S
2665 0053
🭰 T
1FB70 0054
U
256D 0055
V
2573 0056
W
25CB 0057
X
2663 0058
🭵 Y
1FB75 0059
Z
2666 005A

253C
🮌
1FB8C

2502
π 🮖
03C0 1FB96
◥ 🮘
25E5 1FB98
E_
224
NBSP
00A0

258C

2584

2594

2581

258F

2592

2595
🮏
1FB8F
◤ 🮙
25E4 1FB99
🮇
1FB87

251C

2597

2514

2510

2582
F_
240

250C

2534

252C

2524

258E

258D
🮈
1FB88
🮂
1FB82
🮃
1FB83

2583
🭿 ✓
1FB7F 2713

2596

259D

2518

2598
π 🮖
03C0 1FB96

  Letter  Number  Punctuation  Symbol  Other  Undefined


Control characters

Some PETSCII codes cannot be printed and are only used for keyboard input (e.g. F1, RUN/STOP).

PET 2001 keyboard layout, illustrating PETSCII graphics characters

Commodore 64 control characters

PETSCII control characters (Commodore 64)[6]
_0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _A _B _C _D _E _F
0_
0
 
 
 
 
 
 
STOP

 
 
 
WHITE

 
 
 
 
 
SHIFT
DISABLE

 
SHIFT
ENABLE

 
 
 
 
 
 
 
RETURN

 
TEXT
MODE

000E
 
 
1_
16
 
 
CURSOR
DOWN

0084
REVERSE
ON

 
HOME

 
DEL

0008
 
 
 
 
 
 
 
 
 
 
 
 
 
 
RED

 
CURSOR
RIGHT

 
GREEN

 
BLUE

 
8_
128
 
 
ORANGE

 
 
 
RUN

 
 
 
F1

 
F3

 
F5

 
F7

 
F2

 
F4

 
F6

 
F8

 
LF

000A
GRAPHICS

000F
 
 
9_
144
BLACK

 
CURSOR
UP

008D
REVERSE
OFF

 
CLR

 
INSERT

 
BROWN

 
PINK

 
DARK
GRAY

 
MEDIUM
GRAY

 
LIGHT
GREEN

 
LIGHT
BLUE

 
LIGHT
GRAY

 
PURPLE

 
CURSOR
LEFT

 
YELLOW

 
CYAN

 


Commodore 16 control characters

PETSCII control characters (Commodore 16)[6]
_0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _A _B _C _D _E _F
0_
0
 
 
 
 
 
 
STOP

 
 
 
WHITE

 
 
 
 
 
SHIFT
DISABLE

 
SHIFT
ENABLE

 
 
 
 
 
 
 
RETURN

 
TEXT
MODE

000E
 
 
1_
16
 
 
CURSOR
DOWN

0084
REVERSE
ON

 
HOME

 
DEL

0008
 
 
 
 
 
 
 
 
 
 
 
 
ESC

001B
RED

 
CURSOR
RIGHT

 
GREEN

 
BLUE

 
8_
128
 
 
ORANGE

 
FLASHING
ON

 
RUN

 
FLASHING
OFF

 
F1

 
F3

 
F5

 
F7

 
F2

 
F4

 
F6

 
HELP

 
LF

000A
GRAPHICS

000F
 
 
9_
144
BLACK

 
CURSOR
UP

008D
REVERSE
OFF

 
CLR

 
INSERT

 
BROWN

 
YELLOW
GREEN

 
PINK

 
BLUE
GREEN

 
LIGHT
BLUE

 
DARK
BLUE

 
LIGHT
GREEN

 
PURPLE

 
CURSOR
LEFT

 
YELLOW

 
CYAN

 


Commodore 128, 40-column mode control characters

PETSCII control characters (Commodore 128, 40-column mode)[6]
_0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _A _B _C _D _E _F
0_
0
 
 
 
 
 
 
STOP

 
 
 
WHITE

 
 
 
BELL

0007
 
 
HT

0009
LF

000A
SHIFT
ENABLE

 
SHIFT
DISABLE

 
RETURN

 
TEXT
MODE

000E
 
 
1_
16
 
 
CURSOR
DOWN

0084
REVERSE
ON

 
HOME

 
DEL

0008
 
 
 
 
 
 
TAB SET/
CLEAR

0088
 
 
 
 
ESC

001B
RED

 
CURSOR
RIGHT

 
GREEN

 
BLUE

 
8_
128
 
 
ORANGE

 
 
 
RUN

 
 
 
F1

 
F3

 
F5

 
F7

 
F2

 
F4

 
F6

 
F8

 
LF

000A
GRAPHICS

000F
 
 
9_
144
BLACK

 
CURSOR
UP

008D
REVERSE
OFF

 
CLR

 
INSERT

 
BROWN

 
PINK

 
DARK
GRAY

 
MEDIUM
GRAY

 
LIGHT
GREEN

 
LIGHT
BLUE

 
LIGHT
GRAY

 
PURPLE

 
CURSOR
LEFT

 
YELLOW

 
CYAN

 


Commodore 128, 80-column mode control characters

PETSCII control characters (Commodore 128, 80-column mode)[6]
_0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _A _B _C _D _E _F
0_
0
 
 
 
 
UNDERLINE
ON

 
STOP

 
 
 
WHITE

 
 
 
BELL

0007
 
 
HT

0009
LF

000A
SHIFT
ENABLE

 
SHIFT
DISABLE

 
RETURN

 
TEXT
MODE

000E
FLASHING
ON

 
1_
16
 
 
CURSOR
DOWN

 
REVERSE
ON

 
HOME

 
DEL

0008
 
 
 
 
 
 
TAB SET/
CLEAR

0088
 
 
 
 
ESC

001B
RED

 
CURSOR
RIGHT

 
GREEN

 
BLUE

 
8_
128
 
 
DARK
PURPLE

 
UNDERLINE
OFF

 
RUN

 
 
 
F1

 
F3

 
F5

 
F7

 
F2

 
F4

 
F6

 
F8

 
LF

000A
GRAPHICS

000F
FLASHING
OFF

 
9_
144
BLACK

 
CURSOR
UP

008D
REVERSE
OFF

 
CLR

 
INSERT

 
DARK
YELLOW

 
PINK

 
DARK
CYAN

 
MEDIUM
GRAY

 
LIGHT
GREEN

 
LIGHT
BLUE

 
LIGHT
GRAY

 
PURPLE

 
CURSOR
LEFT

 
YELLOW

 
CYAN

 

Commodore 65 prototype, 80-column mode control characters

PETSCII control characters (Commodore 65 prototype, 80-column mode)[10]
_0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _A _B _C _D _E _F
0_
0
 
 
 
 
UNDERLINE
ON

 
STOP

 
 
 
WHITE

 
 
 
BELL

0007
 
 
HT

0009
LF

000A
SHIFT
ENABLE

 
SHIFT
DISABLE

 
RETURN

 
TEXT
MODE

000E
FLASHING
ON

 
1_
16
F9

 
CURSOR
DOWN

 
REVERSE
ON

 
HOME

 
DEL

0008
F10

 
F11

 
F12

 
TAB SET/
CLEAR

0088
F13

 
F14

 
ESC

001B
RED

 
CURSOR
RIGHT

 
GREEN

 
BLUE

 
8_
128
 
 
ORANGE
 
UNDERLINE
OFF

 
RUN

 
HELP

 
F1

 
F3

 
F5

 
F7

 
F2

 
F4

 
F6

 
F8

 
LF

000A
GRAPHICS

000F
FLASHING
OFF

 
9_
144
BLACK

 
CURSOR
UP

008D
REVERSE
OFF

 
CLR

 
INSERT

 
BROWN
 
LIGHT
RED

 
LIGHT
GRAY

 
MEDIUM
GRAY

 
LIGHT
GREEN

 
LIGHT
BLUE

 
DARK
GRAY

 
PURPLE

 
CURSOR
LEFT

 
YELLOW

 
CYAN

 

Base 128

Out of PETSCII's first 192 codes, 164 have visible representations (for the control codes, these are visible when quoted): 5 (white), 17–20 and 28–31 (colors and cursor controls), 32–90 (ASCII equivalent), 91–127 (graphics), 129 (orange), 133–140 (function keys), 144–159 (colors and cursor controls), and 160–192 (graphics). This theoretically permits encodings, such as base128, in DATA statements, or perhaps between PETSCII-speaking machines; for example, 33–127, 160–192.

See also

Notes

  1. ^ The Amiga home/personal computer family uses standard ISO-8859-1.
  2. ^ see On The Edge by Brian Bagnall, ISBN 0-9738649-0-7, pp. 43, 54–55.

References

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.