Welcome to the fourth episode of Lupe Darksnout‘s Backbit Impawsible series.
Lupe Darksnout dove headfirst into her latest Commodore 64 programming escapade, transforming multicolor bitmaps into multicolor character sets. With a dash of ambition and a heavy dose of trial and error, her journey—aptly titled BackBit Impawsible: Part Four—tackles the mammoth task of converting 8,730 bitmaps into usable character sets. Or, well, trying to.
“This is the part where I sigh and ask myself, ‘What have I gotten into?’” Lupe confesses with a laugh.
The crux of the problem is deceptively simple. A multicolor bitmap, with around 1,000 unique cells, needs to be reduced into 256 characters while preserving as much of the original image as possible. Sounds straightforward, right? Except that the sheer number of combinations involved makes even modern quantum computers break into a cold sweat.
Lupe initially thought she could brute-force her way through this problem, painstakingly picking the best candidates one at a time. But the math laughed back. “We’re talking not just millions or billions of combinations. It’s orders of magnitude more than that—an astronomical number,” she explains. “Lucky me, I didn’t realize this at first!”
To tackle this Herculean task, Lupe relies on two key concepts: Pixel Difference and Global Mismatch.
- Pixel Difference measures how similar or dissimilar two 32-pixel cells are. Since each pixel has one of four values (00, 01, 10, or 11), the metric boils down to counting how many don’t match.
- Global Mismatch is the big-picture metric: it calculates how well the character set recreates the original bitmap by summing up all the Pixel Differences across the image. The goal? Minimize this number.
“It’s all about the math,” Lupe explains. “Every decision the program makes hinges on these metrics.”
With her foundation set, Lupe launched her first tool: Character Maker 1. The program had one job—convert bitmaps into character sets. But as Lupe quickly discovered, the task wasn’t just slow; it was glacial.
Running with the SuperCPU in fast mode, the process crawled along, taking nearly an hour just to render a single image. “At this rate, I’d need a human lifetime to finish,” she jokes. Yet, despite the frustration, she couldn’t help but marvel as the images slowly started taking shape.
One of the early lessons learned? Efficiency matters. “Every loop of the program adds one character to the image,” Lupe explains. “And while it’s fun to watch, it’s just not practical.”
As Lupe continued refining her code, the challenges piled up. She introduced optimization tricks, such as a 1,000-byte matrix to flag duplicate cells and prevent redundant comparisons. This helped speed things up but didn’t completely solve the problem.
“It’s exciting to see progress, even if it’s slow,” she says. “I mean, look at that! It’s starting to look like an actual picture!”
But as the hours ticked by, reality set in. Even with all her tweaks, Character Maker 1 wasn’t going to deliver the smooth, 24-frames-per-second performance she’d hoped for. “I put all my eggs in that basket,” she sighs. “Looks like I’ll need to try a different approach.”
Despite the setbacks, Lupe isn’t giving up. She’s toying with the idea of loosening the restrictions she initially placed on herself—exploring full-blown bitmaps with fewer color limitations.
“It’s all part of the fun of programming,” she says with a grin. “Sometimes, you’re just chasing your tail. But hey, that’s where the magic happens.”
For now, Lupe plans to keep experimenting, learning, and pushing the limits of the Commodore 64. And as she does, she invites her fellow retro enthusiasts to join her on this wild, math-filled ride.
“Who knows? Maybe the next breakthrough is just a few lines of code away.”