You know those block graphic symbols that allows you to draw lines, corners, intersections, fine bar charts, etc. they are useful and one can do a lot of stuff, but their code arrangements always struck me as arbitrary / random. But then maybe I just haven't figured out the logic. Does anybody know why they ended up with the codes they got?

  • 2
    You need to look at them in relation to the keyboard layout: not according to ASCII code. eg spade, diamond, clubs and hearts are in a little circle ASZX. This wouldn't make sense if you just looked at the numeric codes.
    – cup
    Jul 23, 2020 at 7:18

3 Answers 3


The "PETSCII" encoding is based on keyboard positions of the original PET chicklet keyboard (*1):

enter image description here

(Taken from Wikipedia)

The keyboard is made similar to basic typewriter keyboards, but ordered in a square fashion, including a top row of symbols but not numbers and a separate numeric keyboard. By every key holding only a single ASCII equivalent symbol (*2), it leads to a direct encoding of ASCII as key position.

As a side effect the whole shift level could be used for graphics, as they did. All symols are ordered in a (mostly) useful pattern, like having UIJK forming the 4 sections of a circle, OPL: doing the same for the corners of a large square and 0.-=the same for a small square.

It not only looks neat on the keyboard but also makes a good UI as far as ordering of symbols can get.

The downside is that graphic symbols are encoded according to the (unsifted) character code. And here combinations like UIJK are simply non-continuous. As listing the PETSCII assignment shows:

enter image description here

(Taken from Wikipedia)

From a programmers perspective this is less than perfect. A logical sequence for related items (*3) could have been more helpful. This is especially true for the 16 codes that form a 2x2 division of a character cell would allow an easy 'bitmap' mode for 80x48 pixel (*4). Much like contemporary TRS-80 and Sinclair's ZX80/81 some years later.

An additionally sad part is that PETSCII itself isn't direct used for display, but translated into screencodes beforehand. If not right ahead, this would have been a good point to reorder.

... and so it became history :)

*1 - The Wikipedia entry for 'Chicklet Keyboard' is a nice example for a retrograde explanation.

*2 - Almost as if the first version was not meant to use shift.

*3 - Much like ASCII offers a monotone sequence for numbers ($30..$39) and letters ($41..$5A). The later according to the usual lexical sequence, as made popular by Bartholomeus Anglicus.

*4 - As usual they have been used anyway, but with a translation layer. Some of them, written in BASIC, look more like on purpose obfuscation.

  • Thanks, now I see. Makes total sense. Now we have 3 answers here and I don't know which one's to accept. The short text only answer was the first. Yours is the most detailed, and the 3rd gives us useful photos of the VIC20 and C=64 to complement yours. All 3 give the same reasonable explanation. Jul 23, 2020 at 12:23
  • 1
    @GuntherSchadow Well, can't help you there :) I'd say pick the one you think a future visitor will get out most - maybe supercat is willing to beautify his answer a bit more? Or roll a dice :)
    – Raffzahn
    Jul 23, 2020 at 12:37
  • What does Bartholomeus Anglicus have to do with anything? My understanding is that the alphabet's order is inherited from the many various ancestral alphabets (Early Roman one, Old Italic ones (including Etruscan one), Greek, Aramaic, Palaeo-Hebrew etc etc etc.) Sep 4, 2020 at 18:51
  • @OmarL True, he didn't invent the use of an alphabetical oder, but the way alphabets are sorted have varies a lot across alphabets, usage and time. In fact, sort orders were invented according to many principles and ad hoc for different works. Like the alphabet according to theological means making 'D' the first letter, as it stand for Deus (God). The sort oder Angelicus developed is special as it is identical to what we (Basically) use today.
    – Raffzahn
    Sep 4, 2020 at 20:35

I think the codes were laid out so that when laid out sensibly on the PET keyboard, the shifted and unshifted forms of each key would have a consistent relationship. When the VIC-20 reduced the number of keys but added the Commodore key, this made it necessary to rearrange the placement of graphics on the keys; since Commodore kept the same arrangement of character codes, however, this meant that the arrangement no longer seemed to make as much sense.

One can see a similar effect in the design of ASCII. Many typewriters used to use a shifted 2 for a quotation mark, early teletypes did likewise, and thus the ASCII code for the quote mark is one bit different from that of the digit 2, even though modern keyboards use a shifted apostrophe as the quote mark.

  • 1
    Even today, most European keyboard layouts have a quotation mark on shifted 2. Could be, the US keyboard is an outlier in this matter Jul 23, 2020 at 7:37
  • 1
    @OmarL US typewriters had (mostly, as each manufacturer had some variation) as well the double mark at the two key. Likewise the (ASCII) ASR33. US PC keyboard layouts originate in the IBM 3270 keyboard which had 'at' at this position. When IBM exported the PC, Layout had to be changed to national layout anyway, and here the common typewriter was taken as template. So yes, 'at' above 2 is an outlier and forced onto millions of helpless US users :))
    – Raffzahn
    Jul 23, 2020 at 11:27
  • @OmarL good example of that are Polish keyboard layouts. There is just "Polish" which no sane person uses, based on local typewriter layout of old times and has accent variants in place of brackets similariy to (old) German layouts, and "Polish Programmer", which is just standard QWERTY with local accent characters.
    – PTwr
    Jul 23, 2020 at 15:18
  • @Raffzahn: The Selectric typewriter predates the 3270, and it placed ' and " on the same key in its present US keyboard location. I suspect its design in turn derived from other electric typewriters designs which were able to separately control the strike force of each type bar, but not use different levels of force for shifted and non-shifted states. Without separate control for shifted/non-shifted force, it would be impossible to make a 2 be adequately dark without making a " be much darker. The Selectric had a one-time-use ribbon, but I don't think earlier machines did.
    – supercat
    Jul 23, 2020 at 15:56
  • @supercat True, in fact, it already happened with the Model A of 1948. Still they were outliers in comparison to mechanical typewrites.
    – Raffzahn
    Jul 23, 2020 at 20:18

For what it's worth, I did a quick photo of my C-64 and VIC-20 keyboards, so it's very easy to see the physical grouping of the various graphics/symbols.

Commodore C-64 Keyboard:

Commodore C-64 Keyboard

Commodore VIC-20 Keyboard:

Commodore VIC-20 Keyboard

  • 1
    The VIC20/C64 keyboardadd another layer of complexity as the number of keys got reduced from the PET design, so their symbols had to be shuffeled as well ... in addition the keyboard was made to work like a traditional one, taking away the shifted position from everything but letters and a few extra keys.
    – Raffzahn
    Jul 23, 2020 at 12:34
  • Which appears to be same as my C128D, which I should probably clean up...
    – PTwr
    Jul 23, 2020 at 15:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .