The PETSCII character encoding that is used on the Commodore 64 (and all other Commodore 8 bit computers) is similar to ASCII, but different: Uppercase and lowercase are swapped! Why is this?
The "PET 2001" from 1977 had a built-in character set of 128 characters. This would have been enough for the 96 printable ASCII characters, and an extra 32 graphical characters. But Commodore decided to replace the 26 lowercase characters with even more graphical characters. After all, the PET did not support a bitmapped display, so the only way to display graphics was using the graphical characters built into the character set. These consisted of symbols useful for box drawing as well as miscellaneous symbols (including the french deck suits).
So the first PET was basically using ASCII, but with missing lower case. This had an influence on the character codes produced by the keyboard:
|Key||ASCII keyboard||PET keyboard|
|A||a ($61)||A ($41)|
|Shift + A||A ($41)||♠ ($C1)|
On a standard ASCII system, pressing "A" unshifted produces a lower case "a", and together with shift, it produces an uppercase "A". On a PET, because there is no lower case, pressing "A" unshifted produces an uppercase "A", and together with shift produces the "spade" symbol ("♠") from the PET-specific graphical characters.
Later Commodore 8 bit computers added a second character set that supported uppercase and lowercase. Commodore decided to allow the user to switch between the two character sets at any time (by pressing the "Commodore" and "Shift" keys together), so applications generally didn't know which character set was active. Therefore, the keyboard had to produce the same character code independent of the current character set:
|key||ASCII keyboard||PET keyboard (upper/graph)||PET keyboard (upper/lower)|
|A||a ($61)||A ($41)||a ($41)|
|Shift + A||A ($41)||♠ ($C1)||A ($C1)|
An unshifted "A" still produces a code of $41, but it has to be displayed as a lower case "a" if the upper/lower character set is enabled, so Commodore had to put lower case characters at the $40-$5F area – which in ASCII are occupied by the uppercase characters. A shifted "A" still produces a code of $C1, so Commodore put the uppercase characters into the $C0-$DF area.
Now that both upper case and lower case were supported, Commodore decided to map the previously undefined $60-$7F area to upper case as well:
|range||ASCII||upper case PETSCII||lower case PETSCII||lower case PETSCII with fallback|
|$40-$5F||upper case||upper case||lower case||lower case|
|$60-$7F||lower case||undefined||undefined||upper case|
|$C0-$DF||undefined||graphical||upper case||upper case|
If you only look at the area between $00 and $7F, you can see that PETSCII reverses upper and lower case compared to ASCII, but the $60-$7F area is only a compatibility fallback; upper case is actually in the $C0-$DF area – it's what the keyboard driver produces.