How to switch between upper/lower case and PETSCII fonts on a C64

Commodore LogoThe C64 can display two sets of fonts: either a combination of upper case and lower case letters (good for any kind of text), or a combination of upper case letters and graphics (default), known as PETSCII characters.

In direct mode you can switch between the two by pressing CBM+SHIFT (i.e. The Commodore Key and SHIFT together).

But that’s no good when you’re app starts – you can’t expect the user to press that combination to see the correct letters on the screen (or that horrible combination of text and weird characters). The good news is that you can switch between those fonts in code too:

POKE 53272,23 :REM LOWER/UPPER CASE MODE
POKE 53272,21 :REM UPPER CASE/PETSCII MODE

While your app is running users would still be able to use the CBM+SHIFT combination to switch the fonts – which is ugly to say the least. But we can manually disable and enable this for users:

PRINT CHR$(8) :REM DISABLE SWITCH
PRINT CHR$(9) :REM ENABLE SWITCH

Here are a couple of examples of what this looks like:

upper-case

lower-case

The “Commodore 64 Programmer’s Reference” explains all this and more. I wish I knew this book existed back in the eighties! You can still grab a copy from Ian’s amazing site commodore.ca (in the Manuals section):





Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.