I wrote a superoptimizer for the MOS 6502. It generates programs up to 11 bytes long; perhaps more if you’re patient and/or have a particularly beefy computer.
There’s a writeup about it here: DeiMOS
The code is available on GitHub, too: GitHub - Aransentin/DeiMOS: A MOS 6502 superoptimizer · GitHub
6 Likes
Hey, fascinating writeup. Welcome to the forum!
The examples have me thinking about what comes next. Shave a cycle off multiplying by ten? Sign me up, that’s a big deal in 6502 terms.
Maybe express objectives in BASIC? Then superoptimize each, patiently building up a collection of Weird Tricks for a compiler, which needs a big database of solved problems but is otherwise not that complex.
An 11 byte window is not big enough to generalize, I know. But ordinary optimization exists too.
Gave me something to think about anyway. Neat project!
1 Like