Building a Modern C64 Assembly AI Toolchain
8 comments
·December 9, 2025afro88
noobermin
the deepest irony of asking someone to write their own blog post when they can't even be bothered to write their own code
tom_
The *40 routine feels a bit questionable. Looks like it'll lose some bits. 24*40 is a 10-bit quantity, and you'll need to track the last 2 shifted-out bits. Throwing one away and using the other to add back into the LSB is probably not the best idea.
This sort of thing is written out three times in the code: https://github.com/dexmac221/C64AIToolChain/blob/a7bbc568c0e..., https://github.com/dexmac221/C64AIToolChain/blob/a7bbc568c0e..., https://github.com/dexmac221/C64AIToolChain/blob/a7bbc568c0e...
I'm not going to spend any time doing the computer's job for it by carefully checking every single one against the other, something it can do with perfect accuracy and no mistakes. Nor am I going to double check whether I missed any, which I probably did, because, ditto.
But, looking at the one at line 541, I might be inclined to suggest the following instead. Please step through this in the debugger or whatever though, rather rather than just taking my word for it.
(to save line count, I've put multiple instructions on a line, separated by ':')
lda tmp_hi:asl:asl:asl:sta ptr_lo ; y*8, an 8-bit quantity
asl:rol ptr_hi ; y*16, a 9-bit quantity
asl:rol ptr_hi ; y*32, a 10-bit quantity
clc:adc ptr_lo:sta ptr_lo ; <(y*32)+y*8=<(y*40)
lda ptr_hi:and #3:adc #0:sta ptr_hi ; >(y*32)+carry out=>(y*40)094459
Really enjoyed reading this post, and wanted to make it more broadly visible. I am planning on trying this out to see how far I can push it.
erwincoumans
Pretty complex project, brings up C64 assembly programming memories (with some freeze cartridge with monitor to enter asm OP codes). It would be interesting to see all the actual LLM queries to get those results.
linsomniac
I know this is going to be an unpopular opinion, but I'd really like to see something put together for the Commodore 64 Ultimate that is a, likely assembly based, environment that leverages LLMs to be able to build games and demos and the like. Looking back to my VIC-20 (I couldn't afford the C64, but wanted one desperately), the thing I loved the most about it really was the end result.
Don't get me wrong, I loved the process of programming, but these days I have so many things going on that I rarely have the time either during or after work to learn assembly or do any significant low level programming.
I like what they are doing with the C64 now, but for me to get any joy out of getting an Ultimate I'd really need something that would let me play with it at a higher level than assembly or basic. I could see that being a lot of fun for both my 16yo son and myself.
aduty
https://marketplace.visualstudio.com/items?itemName=rosc.vs6...
I haven't tried the support for the C or C++ compilers targeting the C64, but that would set you up for developing with the C64 as a target in a modern environment.
If you're wanting it to be on the C64 Ultimate itself, maybe we'll all be in luck in a year or two.
logsr
amazing work!
Great idea and execution. But please don't get an LLM to write the whole blog post for you. It took the enjoyment out of reading it for me. I want to read about your project in your words. Reading it in LLMs words feels disconnected and not genuine.