Smile! You're on Commodore Camera!
Cameron Kaiser hacked a retro ComputerEyes video capture system to get almost real-time video streaming on a Commodore 128 computer.
Due in large part to recent technological advancements that have thrust artificial intelligence into the spotlight, there has been a surge in alarmism fueling concerns and raising questions about its potential impact on society. Critics argue that AI could lead to widespread job displacement, privacy invasions, and even existential threats to humanity.
But for those of us in the know, we recognize that the generative AI tools that have caused some concerns lately will most certainly not lead to the destruction of humanity. As revealed in the first Terminator movie, should machines attempt to destroy us, they will be powered by the MOS Technology 6502 processor that was included in numerous computers and gaming consoles in the 1980s. And that does not look like it is going to happen any time soon. Not only are 6502-based machines severely resource-constrained, but they are also lacking in options for sensing the world around them. The T-800 cannot terminate you if it cannot find you.
Well, that was the happy world we lived in until a few days ago at least. But Cameron Kaiser has decided to tempt fate and give vision to his Commodore 128 computer. The Commodore 128 is powered by a MOS Technology 8502 CPU, which is a minor variant of the 6502. Getting nervous yet?
This is actually not an entirely new idea. A commercial product produced by Digital Vision called ComputerEyes existed in the mid-1980s that allowed computers such as the Commodore 64 and Apple II to acquire images from a composite video source. But, this device had some issues — namely, it took from 6 to 50 seconds to capture a single frame (depending on image quality), and the computer’s display would have to turn off during the capture. For reasons such as these, ComputerEyes was a very poor choice for a real-time video streaming system.
But it is this limited system that Kaiser chose to use to build an almost real-time video capture device. He found that by using a Commodore 128 and making a few tweaks, he could overcome the original limitations of ComputerEyes. While the ComputerEyes software does not run on a Commodore 128, the machine does have a Commodore 64 mode for compatibility.
The reason that the display must be turned off on a Commodore 64 is that the video chip, the VIC-II, periodically halts the CPU to take control of the bus and do some work of its own. This is bad news for the image capture process, which requires strict synchronization, and leads to distortions.
But the Commodore 128 has a second video chip, the VDC, which is still accessible even in Commodore 64 compatibility mode. It is normally used for an 80 column text mode, but can be coerced into generating a 320 x 200 pixel bitmapped display much like the VIC-II. And crucially, the VDC can display an image without interfering with the CPU, so processing of ComputerEyes image captures will not be distorted by interrupt delays.
That got Kaiser halfway to the goal, but the image captures were still just as slow as ever. Analyzing the acquisition source code (which Digital Vision actually provided with the device), Kaiser found that it pauses for long stretches between frame grabs, waiting for up to 85 vertical syncs to happen between each one. What if the software waited for only one vertical sync? That is exactly what Kaiser tried. And it did work — not perfectly, the first 10% of the image was lost, but it was considerably faster. Sacrificing that portion of the image sped up the capture process by about 24%, which for many use cases is a reasonable trade-off.
Kaiser may have pulled off nearly real-time video capture on a 6502 CPU variant, but at least these computers cannot do any machine learning, so humanity should be safe, right? Or is it?