PETSCII
Encyclopedia
PETSCII also known as CBM ASCII, is the variation of the ASCII
character set used in Commodore Business Machines (CBM)
's 8-bit home computer
s, starting with the PET
from 1977 and including the VIC-20
, C64
, CBM-II
, Plus/4
, C16
, C116 and C128
.
) 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 . 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.
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).
5E and a left-arrow ( ← ) instead of an underscore ( _ ) in position $5F. Also, in the VIC-20 and C64 version, the backslash ( \ ) in position $5C is occupied by a British pound sign ( £ ). 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 text mode is not available at powerup, but must be actuated by pressing the SHIFT and Commodore keys simultaneously. Regardless of whether the chip has undergone a graphic "shift" (by holding the SHIFT key down and pressing the Commodore key simultaneously), 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, like for 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
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
article.)
representation, they cannot be portably displayed in a web browser. The following table shows the glyph
s for PETSCII graphic characters where there is a corresponding Unicode glyph, and the Unicode replacement character U+FFFD (�) otherwise. Control character
s and other non-printing characters are represented by abbreviations for 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. 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
. Other Commodore machines used slightly different versions of PETSCII, which used different control characters and in some cases different graphic characters. For example, on the Commodore 128
$07 was the bell control character
, and on CBM machines prior to the VIC-20, characters $2C and $6C both produced a comma character, albeit with slightly different semantics.
The actual character generator ROM used a different set of assignments. For example, to display the characters "@ABC" on screen by directly POKEing the screen memory, one would POKE the decimal values 0, 1, 2, and 3 rather than 64, 65, 66, and 67.
>
Some PETSCII Codes can't be printed and are only used for Keyboard input (e.g. F1, RUN/STOP).
ASCII
The American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text...
character set used in Commodore Business Machines (CBM)
Commodore International
Commodore is the commonly used name for Commodore Business Machines , the U.S.-based home computer manufacturer and electronics manufacturer headquartered in West Chester, Pennsylvania, which also housed Commodore's corporate parent company, Commodore International Limited...
's 8-bit home computer
Home computer
Home computers were a class of microcomputers entering the market in 1977, and becoming increasingly common during the 1980s. They were marketed to consumers as affordable and accessible computers that, for the first time, were intended for the use of a single nontechnical user...
s, starting with the PET
Commodore PET
The Commodore PET was a home/personal computer produced from 1977 by Commodore International...
from 1977 and including the VIC-20
Commodore VIC-20
The VIC-20 is an 8-bit home computer which was sold by Commodore Business Machines. The VIC-20 was announced in 1980, roughly three years after Commodore's first personal computer, the PET...
, C64
Commodore 64
The Commodore 64 is an 8-bit home computer introduced by Commodore International in January 1982.Volume production started in the spring of 1982, with machines being released on to the market in August at a price of US$595...
, CBM-II
Commodore CBM-II
The Commodore CBM-II series was a short-lived range of 8-bit personal computers from Commodore Business Machines , intended as a follow-on to the Commodore PET series, released in 1982.-Technical description:...
, Plus/4
Commodore Plus/4
The Commodore Plus/4 was a home computer released by Commodore International in 1984. The "Plus/4" name refers to the four-application ROM resident office suite ; it was billed as "the productivity computer with software built-in"...
, C16
Commodore 16
The Commodore 16 was a home computer made by Commodore with a 6502-compatible 8501 CPU, released in 1984. It was intended to be an entry-level computer to replace the VIC-20 and it often sold for 99 USD...
, C116 and C128
Commodore 128
The Commodore 128 home/personal computer was the last 8-bit machine commercially released by Commodore Business Machines...
.
History
The character set was largely designed by Leonard Tramiel (the son of Commodore CEO Jack TramielJack Tramiel
Jack Tramiel is an American businessman, best known for founding Commodore International - manufacturer of the Commodore PET, Commodore 64, Commodore 128, Commodore Amiga, and other Commodore models of home computers.-Biography:...
) and PET designer Chuck Peddle
Chuck Peddle
Charles Ingerham Peddle is an American electrical engineer best known as the main designer of the MOS Technology 6502 microprocessor; the KIM-1 SBC; and its successor the Commodore PET personal computer, both based on the 6502....
. The graphic characters of PETSCII were one of the extensions Commodore specified for Commodore BASIC
Commodore BASIC
Commodore BASIC, also known as PET BASIC, is the dialect of the BASIC programming language used in Commodore International's 8-bit home computer line, stretching from the PET of 1977 to the C128 of 1985...
when laying out desired changes to Microsoft's existing 6502 BASIC
BASIC
BASIC is a family of general-purpose, high-level programming languages whose design philosophy emphasizes ease of use - the name is an acronym from Beginner's All-purpose Symbolic Instruction Code....
to Microsoft's Ric Weiland
Ric Weiland
Richard W. 'Ric' Weiland was a computer software pioneer and philanthropist. He was one of the first five employees of Microsoft Corp.- Early life :...
in 1977 . The VIC-20 used the same pixel-for-pixel font
Computer font
A computer font is an electronic data file containing a set of glyphs, characters, or symbols such as dingbats. Although the term font first referred to a set of metal type sorts in one style and size, since the 1990s it is generally used to refer to a scalable set of digital shapes that may be...
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.
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
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 $Hexadecimal
In mathematics and computer science, hexadecimal is a positional numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F to represent values ten to fifteen...
5E and a left-arrow ( ← ) instead of an underscore ( _ ) in position $5F. Also, in the VIC-20 and C64 version, the backslash ( \ ) in position $5C is occupied by a British pound sign ( £ ). 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
Commodore PET
The Commodore PET was a home/personal computer produced from 1977 by Commodore International...
's lack of a programmable bitmap
Raster graphics
In computer graphics, a raster graphics image, or bitmap, is a data structure representing a generally rectangular grid of pixels, or points of color, viewable via a monitor, paper, or other display medium...
-mode for computer graphics
2D computer graphics
2D computer graphics is the computer-based generation of digital images—mostly from two-dimensional models and by techniques specific to them...
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
Grayscale
In photography and computing, a grayscale or greyscale digital image is an image in which the value of each pixel is a single sample, that is, it carries only intensity information...
levels by its provision of differently hatched checkerboard
Checkerboard
A checkerboard or chequerboard is a board of chequered pattern on which English draughts is played. It is an 8×8 board and the 64 squares are of alternating dark and light color, often red and black....
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 text mode is not available at powerup, but must be actuated by pressing the SHIFT and Commodore keys simultaneously. Regardless of whether the chip has undergone a graphic "shift" (by holding the SHIFT key down and pressing the Commodore key simultaneously), 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
Boolean logic
Boolean algebra is a logical calculus of truth values, developed by George Boole in the 1840s. It resembles the algebra of real numbers, but with the numeric operations of multiplication xy, addition x + y, and negation −x replaced by the respective logical operations of...
operation to change these cases to the proper case. Thus, like for 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
Cursor (computers)
In computing, a cursor is an indicator used to show the position on a computer monitor or other display device that will respond to input from a text input or pointing device. The flashing text cursor may be referred to as a caret in some cases...
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
PEEK and POKE
In computing, PEEK is a BASIC programming language extension used for reading the contents of a memory cell at a specified address. The corresponding command to set the contents of a memory cell is POKE.-Statement syntax:...
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. 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 C64Commodore 64
The Commodore 64 is an 8-bit home computer introduced by Commodore International in January 1982.Volume production started in the spring of 1982, with machines being released on to the market in August at a price of US$595...
article.)
Codepage layout
Since not all of the characters encoded by PETSCII are 'graphic' (i.e., not control codes) and not all of them have a corresponding UnicodeUnicode
Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...
representation, they cannot be portably displayed in a web browser. The following table shows the glyph
Glyph
A glyph is an element of writing: an individual mark on a written medium that contributes to the meaning of what is written. A glyph is made up of one or more graphemes....
s for PETSCII graphic characters where there is a corresponding Unicode glyph, and the Unicode replacement character U+FFFD (�) otherwise. Control character
Control character
In computing and telecommunication, a control character or non-printing character is a code point in a character set, that does not in itself represent a written symbol.It is in-band signaling in the context of character encoding....
s and other non-printing characters are represented by abbreviations for 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. Row and column headings indicate the hexadecimal
Hexadecimal
In mathematics and computer science, hexadecimal is a positional numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F to represent values ten to fifteen...
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 64
The Commodore 64 is an 8-bit home computer introduced by Commodore International in January 1982.Volume production started in the spring of 1982, with machines being released on to the market in August at a price of US$595...
. Other Commodore machines used slightly different versions of PETSCII, which used different control characters and in some cases different graphic characters. For example, on the Commodore 128
Commodore 128
The Commodore 128 home/personal computer was the last 8-bit machine commercially released by Commodore Business Machines...
$07 was the bell control character
Bell character
A bell code is a device control code originally sent to ring a small electromechanical bell on tickers and other teleprinters and teletypewriters to alert operators at the other end of the line, often of an incoming message...
, and on CBM machines prior to the VIC-20, characters $2C and $6C both produced a comma character, albeit with slightly different semantics.
The actual character generator ROM used a different set of assignments. For example, to display the characters "@ABC" on screen by directly POKEing the screen memory, one would POKE the decimal values 0, 1, 2, and 3 rather than 64, 65, 66, and 67.
Some PETSCII Codes can't be printed and are only used for Keyboard input (e.g. F1, RUN/STOP).
External links
- PETSCII character map, part 1, part 2, part 3 (JPEGJPEGIn computing, JPEG . The degree of compression can be adjusted, allowing a selectable tradeoff between storage size and image quality. JPEG typically achieves 10:1 compression with little perceptible loss in image quality....
) - An attempt at PETSCII to Unicode mapping, unshifted, shifted
- Commodore 128 PETSCII control characters