• CommodoreServer.com Official Blog

  • by CommodoreServer.com

Articles and information on Internet-enabling your Commodore 64 Computer.

Jun
9

CommodoreServer Font (Commodore 64 Character Set)

There are many places where CommodoreServer.com can display characters and text in the form of the Commodore 64 character set. You will need to install the CommodoreServer font in order to see the characters properly.

Why another Commodore font?

Indeed, there are other fonts out there that mimick the Commodore 64 character set, but they usually fall short in the way of mapping the fonts.  Some of them do not even have the full character set (all characters in both upper- and lower-case and reverse characters).

The CommodoreServer font is a complete font with all the characters mapped, in most part, to their proper places.  For instance, did you know that a lower-case 'a' on a PC or Mac displays as shifted A on the Commodore 64 ('')? The same is true in reverse: an upper-case 'A' on a PC or Mac displays as a lower-case letter on the C64 and other Commodore computers.  The term "PETSCII" is used to distinguish standard ASCII from Commodore ASCII because Commodore mapped the ASCII characters differently from the way they are defined in standard ASCII.

The CommodoreServer font maps characters so that displaying a character on a PC by its ASCII value will look the same way on a Commodore.  This allows a one-to-one translation when displaying ASCII characters on CommodoreServer.com (i.e. you will see them as a Commodore would display them if the Commodore didn't translate the PC data).  There are a couple of exceptions to this due to the complexity of font mapping, but this will be explained later.

Example

Here is a brief example of how a directory listing will look on CommodoreServer.com both without the font and after the font is installed on your system.

Without the CommodoreServer font, the directory will look like:

With the font installed, the same directory listing will look like:

Using the CommodoreServer Font

Font Mapping

The Commodore character set is a bit tricky. When I designed the font, I originally wanted every character to map directly to its ASCII equivalent. But then I started realizing that it was going to be a challenge.  Here's why:

Each character in the basic ASCII table (characters 32 - 127) maps directly to the same PC ASCII table.  A lower-case 'a' on the C64 will produce what is expected on a PC - an upper case 'A'.

Characters 0-31 are control codes and do not have a symbol (or glyph) for this range on a PC.  Commodore uses this area for its own control codes, such as printing the color white (CHR$(5)) or pressing RETURN (CHR$(13)).  CommodoreServer.com had the need to display some sort of character when viewing the directory sector for these codes. What do these look like? Some programs display reversed characters @ through left-arrow.  This is the same approach I wanted to take, but was unable to map any characters to 0-31.  It seems fonts are not able to map to this range; probably because nobody ever knows what symbol to put there and also because these characters are not printed - they are used for controlling input and output on a PC (such as RETURN - which tells the computer to return the cursor to the beginning of the line and a LINE-FEED which tells the computer to advance the cursor to the next line).

A similar issue lies in the range of 128-159 which are rarely, if ever, mapped in a standard font set.  This being the case, I decided to use this area to correspond to the reversed characters I was going to use for 0-31.  So to display a character in the sector viewer when it calls for an ASCII value of 0-31, I simply add 128 and get the reversed @ through left-arrow, as described above.

The next range of characters are from 160-191.  I mapped these the same in the font.  Displaying an ASCII value from the Commodore in this range will map correctly on a PC. You can test this in your favorite word processor by holding the ALT key and typing 0166 on your number keypad (this only works on a PC - I don't know how to do it on a Mac).  Here is what it looks like when I type this (you'll need the font installed to see the character correctly): '¦'

Lastly, since the Commodore uses 192-255 to repeat characters, I decided to use this space to encompass all of the other characters in the Commodore character set.  192-223 are the same as 128-159 - reversed A thru left-arrow.  224-255 are reversed characters of 32-63.  That's 255! How can I fit any more characters in? There's still all of the lower-case and reversed-lower case characters.

Indeed.  Keep in mind that the Commodore does not display these characters.  You have to change case by holding the COMMODORE key and pressing SHIFT.  But this does not change the ASCII values.  It simply displays different symbols (again, glyphs) for the same ASCII values.  I did the same thing by mapping the other characters to a different range.  Font design is complicated, but for simplicity I will say that it is possible to put thousands of glyphs into a font.  I placed the remaining characters in this extended area.  256-286 are reversed characters of 161-191.  287-312 are the small letters.  313-338 are reversed small letters.  And finally, there were a couple of extra characters the diagonal lines (seen on a Commodore by typing a shifted English Pound sign and changing to lower-case) and the check mark (seen on a Commodore by typing a shifted @ and changing to lower-case).

One last thing.  All characters are additionally mapped to the same number in the font, plus $F000 (61440).  In other words, character 313, or $0139 (a reversed small a), is the same as 61753, or $F139.  This is what is known as a private space and is supported by True Type fonts and most operating systems.  You may use this mapping if it makes life easier for you.

There you have it.  All characters are mapped as described above.  If you wish to use the font on your Own Web site, you are more than welcome to.  However, I ask that you please reference CommodoreServer.com in a visible links area where people can find the source of the font, just in case there are any changes, fixes or additions to it.

Use this graphic and link it to CommodoreServer.com if you use the font on your own Web site:

The mappings described here will assist in displaying the proper characters in your Web site as well.

Download the CommodoreServer Font

I strongly encourage you to download and install the ComodoreServer font so that you can take full advantage of all features of CommodoreServer.com.  Without it, you won't be able to read some of the directory listings properly, or see text that members include in their blogs where they use the font.  There are also other areas where the font will come in handy, such as when you view a BASIC file or Machine Language disassembly, or when you view the sectors of a disk.

Download the CommodoreServer Font Now

Leave a Comment

You must be signed-in to post comments.

Responses