// 2022-09-17 // by Elder0010

Commodore PET demo released in 2022 by Genesis Project.
Release date: 03/07/2022
Credits:
My first Commodore PET demo ever, released at Gubbdata 2022. A BRIGHT SHINING STAR introduces a new video mode on the PET, called PECBM (Pet Extended Char Bitmap). This video mode can display hi res graphics by using an hardware trick.
By default, the Commodore PET can display only characters from the PETSCII charset. The charset is not redefinable as it is in the Commodore 64 (for example).
The new video mode is able to display mixed PET and hi-res graphics.
The trick is to rewrite the character pointers every rasterline. The
length of each line is 64 cycles, therefore you can
rewrite up to 10 characters using an unrolled loop, leading to an 80px
wide area for the hi-res graphics.
Other characters of the same char-line can be used for standard
PETSCII gfx.
The character ROM has been analyzed to find all the usable pixels
combinations for each 0/7th line of each character. Keep in mind that
each 0/7th line can be chosen between each 0/7th line of any
character.
In short: since the character line counter loops from 0 to 7, if you are for example at line 2, you can choose to display any line 2 of any character.
Considering that the whole charset is available also in reverted mode, there are enough choices available to display complex hi-res graphics.
PECBM has been used in the door scene, as well as in the astronaut face scene, in the accept no limits slogan and in credits scenes.
The last two mentioned scenes show that PECBM animations are possible, even though some compromises must be taken into account.
The PECBM full screen graphics have been created using a PETSCII editor in conjunction with a custom PECBM editor available at: www.elder0010.com/uploads/PECBM The PECBM editor uses the Levenshtein Distance algorithm to convert a stock 80x200 1bit image to PECBM format.
At each rasterline, the video circuitry of the computer reads the pixels data from the character ROM and displays it. If the character pointer is changed to another one (say from A to B) after the current character line data has been displayed, the next line will be fetched from the new character (in our example, from the B). By wisely choosing which characters to use, it’s possible to display meaningful high resolution graphics mixed with the standard PETSCII.
The actual graphics used in the PECBM sections have been created by LRNZ.
This demo works only on earlier PET 2001-N models with 32kb of RAM. The executable is loaded between $02c0/$55e9. Each scene is crunched using Exomizer and gets decompressed in the remaining 16KB of RAM. The total size of the uncompressed scenes is more than 80KB, so it’s a pretty good compression!
I tried to exploit the CRT monitor as much as possible for the effects. For example, a sort of smooth scroll feeling has been obtained in the intro and in the space invaders scene. X Since the tube phosphors have a slow decay time, moving things very fast (8px / frame) fools the eye enough…
Newer 40xx and 80xx CRTC models are not supported. Some effects require cycle exact timing, so it could not work in your emulator. However, a custom emulator build tested on XPET / Vice version 3.6.1 (Windows build) is provided. See the notefile in the floppy disk for tech info.