BACK TO THE PET (Commodore PET demo, 2022)

We don’t usually feature the demoscene much here, but this recent demo on the PET caught my eye:

This is a playing of shiru8bit’s excellent “Back to the PET” demo compo on physical hardware with amplified audio out. This is amazing software for a 1MHz 6502 microprocessor system packaged into a standalone 29KB “PRG” binary. This makes exclusive use of the “PETSCII” character set in 40x25 text mode.


NOTE: “Back to the PET” is a homage to a scene in the “8088MPH” demo for the IBM PC (CGA), both inspired by the excellent “Back to the Future” movie released in 1985 with Michael J. Fox.


In honored memory of Jack Tramiel, Leonard Tramiel, Chuck Peddle. For an outstanding in-depth paper about the PETSCII character set, refer to:
PETSCII – A Character Set and a Creative Platform (22 page PDF)


Oh no!

I’m currently working on audio for the PET 2001 emulator – and Back to the Pet is the most important test criterion for this. After some adventures involving the Web Audio API, I’ve it basically working, but I am still missing low frequencies, i.e. the bass line. (I fear, it may be actually an issue with the 6522 VIA emulation.) –Anyways, I’ve heard this a lot in the last few days (minus the bass line)…

More seriously, this is highly impressive.

Regarding shiru8bit’s music, there’s also the “Faulty Robots” album (mostly tracks based on in-game music for the Attack of The PETSCII Robots game that failed to become implemented, the two last tracks are more interesting):

(On basecamp: Faulty Robots | shiru8bit )

And here’s a related blog article by shiru8bit on the backstory, the various tracks, and the history of PET CB2 sound:

Finally, have a look at this PET demo (also from last year), “A Bright Shining Star” by Genesis Project, which really pushes the (rather humble) limits of the PET video capabilities. (Think, PET goes Atari 2600 and races the beam, but only for 10 8-pixel blocks per scanline, as a PET scanline is just 64 CPU cycles.)

And, yes, be assured, the PET still doesn’t have a high-res video mode.

1 Like

For those not familiar with the intricacies of the PET: The PET has no audio chip. It doesn’t have any dedicated audio hardware, It originally even didn’t have a speaker.

But it does have a 6522 VIA chip for communications, as found on many 6502 systems. The VIA has two bidirectional I/O ports, port A and port B, which are normally in handshake mode for handling serial I/O. It has also two timers which are connected to these ports. The second timer, connected to port B, may be set in a “free running” mode, where a serial register is shifted to the right on each clock tick. The least significant bit of this shift register is applied to the “peripheral port 2 control line”, or CB2 to in short. In other words, by selecting a suitable bit pattern for the shift register and suitable timer frequencies, we get a square pulse wave on CB2. By connecting this line (available at the PET’s user port) to a speaker (by a very basic circuit) we can actually create audio, known as “CB2 sound”. As did a few of the games, and now this fantastic demo.

The sound is rather characteristic, as it can’t produce all frequencies, but it can produce some interesting timbres, which are hard to produce by any other means. (Mind that the down-sampling ratio from the PET’s 1MHz clock speed to high quality digital audio of 48KHz is 20.83 : 1, but it’s just an either high or low 1-bit signal.) As this is all handled by timers inside the 6522 VIA (which also provide interrupts), it’s also quite economic in terms of CPU load.


(The famous audio diagram from Space Invaders for the PET.)

The really impressive part in shiro8bit’s music are the low frequencies. The lowest you can do with usual CB2 sound techniques is 245 Hz. So he had to invent some new IRQ-based techniques to directly jam new contents into that serial shift register, which came with their own obstacles…

1 Like