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?
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 VIC-20 Keyboard:
Answered by Geo... on August 20, 2020
The "PETSCII" encoding is based on keyboard positions of the original PET chicklet keyboard (*1):
(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:
(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 the have been used anyway, but with a translation layer. Some of them, written in BASIC, look more like on purpose obfuscation.
Answered by Raffzahn on August 20, 2020
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.
Answered by supercat on August 20, 2020
1 Asked on January 3, 2022
5 Asked on December 25, 2021 by masteraldo
1 Asked on December 25, 2021 by marko-l
2 Asked on December 23, 2021
2 Asked on December 23, 2021 by kbc
23 Asked on December 9, 2021 by richf
2 Asked on December 9, 2021 by fancypants
1 Asked on November 24, 2021
2 Asked on November 12, 2021
1 Asked on November 7, 2021
19 Asked on August 25, 2021 by brian-h
14 Asked on August 25, 2021 by mr-chem-question
7 Asked on August 25, 2021 by b-yath
11 Asked on August 25, 2021 by nibblypig
4 Asked on August 25, 2021 by jdebp
Get help from others!