The killer POKE for the Commodore PET

When I was a kid, computer science textbooks taught a language called Basic. They explained various commands, including POKE, which changed values in memory, or on a chip register. The books went out of their way to explain that you can’t harm a computer with a command, even a POKE. But it turned out there was an exception–the infamous POKE 59498,62 on the Commodore PET. The infamous killer POKE.

The killer POKE sped up the Commodore PET’s video output at the expense of degrading the video quality. The tradeoff was worth it, except it could damage the machine over time.

The legend of the killer POKE

killer POKE
On an early Commodore PET like this one, the killer POKE, POKE 59498,62, speeds up its video output by 106%. On later models, it garbles the screen. But I don’t recommend you use it. If you want the speedup, perform Adrian Black’s mod, linked and described below.

The killer POKE has always had an air of mystery about it. I knew in the 1980s that one existed. It was mostly useless trivia by then, as it affected a machine that had been off the market about a decade. But the subject came up from time to time.

There are any number of places I could have found it. Two likely places are The Transactor, an extremely technical Commodore magazine, or Run, a magazine that had a monthly column called Magic that listed useful tips and obscurities. I may have also found it on a bulletin board.

I remember seeing it and writing it down in my notebook where I kept interesting commands. But I don’t remember seeing any detail in the 1980s about it, just that we weren’t supposed to use it. And of course I don’t have that notebook anymore to see if I might have written down any more than “this can damage your machine!”

The killer POKE on the C-64

On a Commodore 64, the command had no effect, since that address in memory was in the middle of a seldom-used block of RAM underneath the machine’s ROM. Since it was just RAM, writing to it did no harm. Since it coexisted with some ROM, it took some trickery to read it back out.

There’s little reason to mention this except word of the killer POKE was still circulating in the late 1980s, when the dominant Commodore computer was the C-64. It’s entirely possible that people tried it out on their 64s to prove it was an urban myth.

How the killer POKE works

Youtubers Adrian Black and Shelby Jueden studied the Commodore PET in 2020 to find out what the killer POKE was all about. I was certainly interested, since there aren’t a lot of Commodore mysteries left.

PETs are difficult to find and rather valuable these days, and Jueden didn’t want to damage his by accidentally running a piece of software that contained the killer POKE unknowingly. So he and Black studied what the killer POKE does and how to protect their valuable PETs. What they found probably wasn’t what either of them expected. It certainly surprised me.

Jueden found on later PETs, like his 4032, it shrinks the display and makes the machine mostly unusable. It’s very clear when you’ve issued it. And your inclination is to shut it off immediately.

Black found that pin 15 of CIA #1 on the PET 2001 is tied to a 74LS08 in the video circuit. The way things are supposed to work, the PET’s video routines read the address corresponding to pin 15, which is address 59498. When the address contains a certain value, it’s safe to update the screen. If it’s not, the PET waits until it does.

But if you POKE a 62 into that address, it sets the all-clear, regardless of what the video output is doing. By eliminating the wait, the PET’s video runs 106 percent faster. There’s a visible side effect of occasional snow on the screen, but that’s tolerable. But there’s a side effect.

Why the killer POKE can damage a PET 2001

The side effect is that setting address 59498 to 62 runs pin 15 of the 6522 and pin 8 of the 74LS08 to ground. The 6522 doesn’t especially care, but the 74LS08 is still trying to do its job, so it ends up fighting it. Over time, this appears to damage the 74LS08, and it may also damage a transistor in the PET 2001’s CRT. But it’s not an instant death like I’d been led to believe and you might have been led to believe. It’s slow and gradual and it’s not even clear it affects all PET 2001s.

When you run the command on a later PET, like Jueden’s PET 4032, you get a shrunk screen. Whether it would damage the CRT is unclear, but there’s little reason to find out, since nobody wants to use a half-size screen. Especially considering the PET’s display was already rather small anyway. This incompatibility caused the killer POKE to fall out of favor after a short time. It also means you won’t run the command accidentally on a newer machine. You know when you did it.

Had Commodore strategically placed a diode or possibly even a resistor in the path, they could have kept the killer POKE from damaging the machine.

Why would Commodore make a command that damages the computer?

Which raises the question: Why did Commodore allow the PET 2001 to have a command that would damage the machine?

The answer is, it was a bug. A bug in hardware rather than software, but a bug. Commodore intended the PET to be an inexpensive computer. While that diode or resistor wouldn’t add much to the cost of the machine, Commodore was trying to keep costs down. On first blush, the part was optional in that instance. There other cases in the machine’s design where it was absolutely optional. So Commodore opted to leave out the optional parts. And nothing bad happened. Except in that particular edge case. Maybe this is what Steve Jobs meant when he called the PET inelegant, but I doubt he looked at the PET board that closely.

The killer POKE was probably discovered by a tinkerer who was examining the PET’s ROM routines, noticed the delay, and wondered why they were there. Naturally, someone making this discovery would try to disable them by issuing the command POKE 59498,62 to see what would happen. It’s almost exactly like overclocking a video card today. The trick worked, so word spread, and later on, someone discovered the side effect. And eventually word got out not to use that command. And people who didn’t understand what the command did, only that it could potentially harm the machine, spread the word. That created the legend.

The damage is certainly repairable. The 74LS08 never was an expensive chip and neither is the transistor in the CRT. The labor was the expensive part. Even in the 1970s, it was probably a $50 repair at most. But of course if you had an expensive PET computer, you wanted to spend your $50 some other way, and didn’t want it in the shop where you couldn’t use it.

Working around the killer POKE in software

To get the benefit of the killer POKE without the risk, all a developer would have needed to do is write custom screen output routines that skipped the check. This would be slightly faster than using the killer POKE, since it wouldn’t waste three instructions reading the CIA chip and looking for a value of 62. You’d still have the side effect of artifacts on the screen, but wouldn’t ground parts that shouldn’t be grounded.

There would be some risk of compatibility issues, however. Of course that ended up being a problem anyway. As long as there was room on the disk or tape for both a PET 2001 version and a version for later PETs, this wasn’t too much of an issue. You could run the 2001-specific version for maximum speed on that machine.

Fixing the killer POKE

Adrian Black devised a fix for the killer POKE. It enables the speedup permanently, but in a way that doesn’t damage the 74LS08 or the transistor in the CRT. All you have to do is bend up pin 15 on the CIA #1, then attach a 460 ohm resistor between it and ground. In his video, he uses a nearby capacitor. But you could just as easily use CIA pin #1. The resistor protects the chip if someone changes the pin from an input to an output through software, which could cause a dead short.

The result is a faster PET 2001, without the risk of damage. It’s a modification to the machine, but you can buy a newer 6522, bend out its pin 15 and solder the resistor between pin 15 and pin 1, then place the newer chip in the socket to make the mod reversible by replacing the original chip. The 6522 is a very common chip and it’s still easy to find today.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: