Saturday 5 October 2013

Horace goes PETSCIIng

PETSCII is a variation and extension on the ASCII set of characters that has its origins in the 1970s. Behind the acronym stands the rather grandiose title of "PET Standard of Information Interchange." PET, again, was one of Commodore's first computers, and stood for Personal Electronic Transactor.

That's it. That's all you get. (Plus some colours, too)

As ASCII character sets only indicate 128 characters, and the sets can conveniently have 256 characters in 8-bit computers, it was meaningful to add precisely 128 new custom characters to the set, facilitating some rudimentary graphics for menus and games.

Different manufacturers favoured different ideas. The IBM set was quite commonly used in conjunction with ANSI colour and positioning codes for producing graphics in text terminals, bit similar to Teletext mode included on many TV sets. ANSI graphics was still quite popular in the 1990s with bulletin board systems, as there was no wide standard for transmitting pixel graphics over the slow telephone lines.

Just a mock-up...
One of the more inventive and useful sets was PETSCII from Commodore. Commodore was quite persistent in using their own variant: From PET computers to VIC-20 and Commodore 64 and all the later models, such as C16, C128 and PLUS/4 all use PETSCII. Although the set evolved slightly in the transition to the C64 and onward, it's essentially the same set. The PETSCII is not a simple ASCII extension. The lower case ASCII letters have been substituted for more graphic blocks. (It's possible to activate a text mode that includes both lower and upper case.)

Don't look up the original. Please.
The amount of colours and resolution changes between machines. Vic-20 has horizontal resolution of 22 characters, whereas the C64 has 40. I suppose the same set is usable in the more obscure 80-column mode supported by some C128 modes.

Although these text modes are arguably superceded by bitmap graphics, there's still quite a lot of interest toward these constrained graphical forms. Just as there is ASCII art and ANSI art, there's PETSCII art. The limitations provide an interesting challenge for creating illustrations and art.

Horace on a C64? Blasphemy! (A directly converted image)
One of the stranger limitations of the C64 character mode (though not unique to Commodore) is that only the foreground colour can be adjusted for each character position, whereas the overall background colour must stay the same. The VIC-20 has even more limits, only 8 of the 16 colours can be used for the foreground text. Although the C64 supports an extended character mode that enables both attributes for any screen character, it is essentially a modified bitmap mode and not considered pure PETSCII.

Despite the fairly narrow set of characters, there are still a satisfying number of visual genres that can be pursued through PETSCII. The actual resolution of a C64 PETSCII image is still 320x200, and the character set is so diverse that it offers a tantalizing possibility of looking like something else than "just" text graphics. There's also the fact that character graphics take up less memory than the resulting bitmap would, and lays a foundation for different animation styles.

Some artists favour a more purist text-art look with clearly indicated black background, whereas some might try to create realistic images converted from photographs or drawings. There are contexts where colours are not possible or appropriate, and this poses another starting point for expression. Colour areas are another starting point, and characters would be used sparingly, such as the surprisingly versatile 45-angle tiles. Some tricks are needed to get around the background colour limitation.

This picture uses almost exclusively square blocks, 45-angle triangles and lines.

How to go about creating PETSCII art? Well, Using a real C64 or an emulator is one starting point. The BASIC editor forms a rudimentary graphic scratchpad: all the characters and colours can be accessed from the keyboard. The real computer has the handy graphics printed on the keys, whereas on an emulator you would have to know the keys by heart. BASIC code could also be used for producing random PETSCII art, not a bad premise at all. In fact, there is a book that discusses various generative code approaches through one PETSCII example.

However, without a freeze cartridge, storing your work can become difficult on a physical computer. (Some cartridges also offer screen editing features.) It's also easy to lose the screen data by messing with the wrong keys.

Truth be told, there's only that much that can be sensibly done without a proper editor, be it on a C64 or on some modern computer. Copy/Paste, undo, file operations make life a bit easier. All the examples on this page have been made with an editor that runs on modern platforms, such as PC, Mac and Linux. (Link below)

A random mess

There is a fascination to PETSCII that is similar to low-resolution pixel art, yet the limitations are in ways more severe. In a strange way, the character art is more easy and liberating than pixel illustration. The other side of constraints is always their enabling nature, and the rapidness of the way PETSCII can be explored for interesting effects is the reward of these limitations. 

This somehow sums the value of old computers to me. Even though underpowered, there's always some features that surprise me with simple effectiveness, expression, personal style and flair.

Marq's PETSCII editor and a gallery of art (The editor, written in Processing, is available for PC, Mac and Linux.)