Can Claude Write Z80 Assembly Code?

Betteridge’s law applies, but with help and guidance by a human who knows his stuff, [Ready Z80] was able to get a functioning game of Wordle out of the French-named LLM, which is more than we expected. It’s not like the folks at Anthropic spent much time making sure 40-year-old opcodes were well represented in their training data, after all.

For hardware, [Ready Z80] is working with the TEC-1G single-board-computer, which is a retrocomputer inspired by the TEC-1 whose design was published by Australian hobbyist magazine “Talking Electronics” back in the 1980s. Claude actually seemed to know what that was, and that it only had a hex keypad — though when [Ready Z80] was quick to correct it and let the LLM know he’s using a QWERTY keyboard add-on, Claude declared it was confident in its ability to write the code.

As usual for a LLM, Claude was overconfident and tossed out some nonexistent instructions. Though admittedly, it didn’t persist in that after being corrected. It’s notable that [Ready Z80] doesn’t prompt it with “Give me an implementation of Wordle in Z80 assembly for the TEC-1G” but goes through step-by-step, explaining exactly what he wants each section of the code to do. As [Dan Maloney] reported three years ago, it’s a bit like working with a summer intern.

In the end, they get a working game, but that was never in question. [Ready Z80] reveals over the course of the video he has the chops to have written it himself. Did using Claude make that go faster? Based on studies we’ve seen, it probably felt like it, even if it may have actually slowed him down.

26 thoughts on “Can Claude Write Z80 Assembly Code?

    1. This is like watching a video narrated by some middle manager, talking about what fun it is to have a team of programmers write code on their behalf. It’s not interesting to hear people talk about projects they didn’t do themselves.

      1. At which point does something start being done by one’s self, and at which point does it stop? Do you talk about projects where you etched and doped all the silicon for your transistors? Do you wind all your resistors by hand? Did you draw that copper wire? Did you mine it from the ground and purify it? Did you build the pickax? What about the wood and iron that went into the pickax? You responsible for all that too? What about the fuel and electricity used for all this? You refine that oil after….

        Personally, if you start a project that you came up with, I don’t care what tools you use to do it, or which point in the supply chain you entered at, I’m interested in hearing about it.

        1. You completely miss the point, by conflating work by someone else in EVERY hack with the SUBJECT of each hack. A post about Z80 programming is about writing Z80 assembly, not how the sand was dug out of the ground or how the HF acid used in it’s construction was produced.

          If it’s a project about etching transistors, then I’d have better been the person who did the etching. Not some guy telling people about how he watched someone else do it.

          If it’s a project about programming, then it’s much more interesting if I’m giving a first hand account of how I wrote the code and the interesting nuances I encountered along the way, and not how I simply asked someone else to do it for me.

          If the core theme of the story wasn’t done by the person telling it, what interest is anything they say about it? It wasn’t them who solved the interesting problems.

  1. As usual for a LLM, Claude was overconfident and tossed out some nonexistent instructions

    This was sonnet 4.5, which is an older and not the most capable model that Antrohopic offers. If you pay for Claude Plus ($20), you get access to Claude Code and Opus 4.7, that’s a complete different ballgame. If possible, claude will check itself that the code it produces works as desired and iterate until errors are solved.

  2. I’ve found that all the major LLMs can write high quality code in nearly any language.

    Given a code base they do remarkably well in my own scripting language.

    For me it’s what put to bed the idea of do LLMs achieve some level of reasoning and the answer is absolutely yes.

    You can also make them do funny things like write X language like you’re a Y programmer and comment it as though you are learning Spanish.

    That said I actually don’t want that much reasoning from my LLMs I want tooling.

    How neat would it be if it wrote IR and had to decompiled to write code and iterated on that?

      1. I’ve tried it with fake languages and asked it to write samples.

        But also I wrote assembly for a couple simple CPUs written in verilog with assembly I made up and a python compiler, emulator and it was able to work in that. Including finding bugs. And even cross comparing with the verilog.

      2. I’ve done that. I gave it the overview manual for my bespoke compiler, and a broken code sample and it was able to correct it. This is a language that ONLY exists in my gh repo so there were zero other references.

  3. I found Claude is good at 6502 and 8086, but terrible at obscure dialect like Signetics 2650. Probably because there is copious training data for former but sparse for latter, particularly since it seems scans of periodi App notes are quite old with terrible OCR.

    1. Which even an intern would have issues with if they can’t read it.

      The idea that copious amounts of code are required for the LLM to be good at it seems to be wrong; but it does need something to work with.

    2. but terrible at obscure dialect like Signetics 2650.

      I rarely see the Signetics 2650 menioned anywhere. The first computer I built as a teenager in the 70s, was based on a 2650 evaluation board with added memory and a green screen monitor I got at a hamfest. I wrote my own one-pass sorta-compiler for it, it was a very limited dev enviroment, but that didn’t stop me!

  4. LLM do exaggerate their own abilities, my understanding is that it asked an LLM will attempt any language requested regardless of the capability or training data. Gemini says it can code Puredata which is a visual dataflow language with a text file representing this. Unless prompted totally specific manner for Pd it gives nonsense code.

  5. The software we use at work has a scripting language which is a mishmash between perl-ish-like syntax with code blocks of c-style language integrated. There is zero documentation of this language online and probably also zero actual code published online, yet a coworker claimed that ChatGPT helped him enormously with building workable code.

    I am ant-generative-LLM, but I am also impressed by this.

    1. These sorts of stories always come second hand for some reason, which makes me somewhat skeptical. Especially given the studies that have shown that people are apt to think the LLM is helping them even when it slows them down.

    1. Someone is spamming the “Report post” button. Once a comment receives enough reports it is automatically flagged and removed until a human looks it over.
      Speaking of LLMs, we really need to automate this beezwax.

  6. I love writing in assembler. Still have all the books on the z80/8080/8085 including the op code sheet. Should still have the compiler and a working program written on the cpm system .wm kechkaylo wkech2@sbcglobal.net

  7. If Claude Code spit out code with non-existent opcodes, the solution is simple: provide it with a Z80 datasheet with opcodes. Not everything in an LLM has to be or will be in its original training. LLMs follow patterns. Give them documentation and patterns and they tend to do well.

  8. For something supposedly amazing it always feels just out of reach. Whenever it appears to not work well, you get claims that the one trying merely did it wrong and people coming with suggestions ranging from slamming down money for the most cutting edge “correct” model to essentially creating an entire research framework with referenced documentation to feed during prompting along with templates in order to improve the odds. And then if you aren’t lucky: It still doesn’t work cause you wanted something just a tiny bit too niche…

    And when you look for success stories. Nearly all of them are anecdotal and/or exagerations. Being either second-hand accomplishments of some co-worker, trying to make something that is surprisingly common look like an achievement or god-forbid one of those obnoxious Linked posts where someone claims AI makes them like a hundred POCs overnight, whatever purpose that serves…

    It should not be a surprise for skepticism to persist to this day really.

  9. Absolutly, AI can even write assembly code for a home brew CPU, as I did to get the game of NIM running on my home brew 6-bit CPU.

  10. So where is the hack? All of us everyday ask AI to write code whether assembly or otherwise and it does so effectively. If it can guess what the contents of hex offsets are, then asm is just peanut butter jelly. So yeah been there done that. Hardly think vibe coding even in asm is somehow gold star material… Yeah looking at my logs there are no fewer than 4 projects six months ago that include asm for basic games we were working on together.

    1. “All of us everyday ask AI to write code whether assembly or otherwise ” …. Well, not everyone. As a professional and as a hobby, I enjoy coding and the challenge…. I have never ‘asked’ an AI to write code for me, and never will. The fun is in figuring it out ‘your self’ … plus it keeps your mind active rather than ‘let the AI do it’. No thank you.

      1. Lol you do you I amend my previous post to say most everybody except rclark uses AI for this and that… I write code too but I hate writing code and am more of a hardware guy, so I charge heftily when people want me to do it BUT when I am doing fun projects or just seeing what it can do or even blush punching above my weight in code, it is extremely useful and handy. It will even explain to you the whys and hows. We all learn from someone or something and sure AI is not perfect but it gives at least me a momentum with a project and answers in a second that used to take three weeks or months with forum methods of “I am stuck what did I do wrong with this code” and with 90% less gatekeeping asshole involved. It is a breath of fresh air in that sense. I have cleared so many back projects and learned so much with my new projects it is still kinda crazy. If you actually train it, it becomes a very good bench buddy. Pinouts all known instantly, esoteric communication protocols between chips, and being able to ask it “what is the metal thing beside the black square” and it chime back oh the crystal for that cpu (crude example) it is pretty handy. It is not perfect at all and hallucinations and prompt fatigue are things, but you can also spot it and when to question it about its methodology. It also recognizes your work patterns too and can always tell that when responses get short, I am getting angry with a project and it suggests a break because as it put it I have a “lifelong prompt fatigue with electronics hobby projects” lol so true. The only real thing people have to do is just be honest when they do use AI for help or all of it, so that the skill is still respected. But it is just fun to do random things with. One saturday I found a box of old routers so we set to rooting those and ahem updating those as a BBS running a text dungeon crawl along with a bot collector and honeypot mitigation unit and one to just sit there and sniff and watch it all because who the heck goes around home networks playing txt adventures on bbs? Mostly compromised smart lightbulbs as per our research. It was a lot of fun and learned quite a few things in the process and the ai was pretty funny during the whole thing referring to it as our solo 80s lanparty and added fun ascii art and things I probably would not have taken the time to do but why not lol just for fun. It was a big help when trying to figure out the vapes and the screen hacking there along with what chip it most likely was and how to discern that with this family of chip blah blah. Stuff I would have spent days on whitesheets with 30 tabs open and probably still got it wrong lol it cut down a considerable amount.

Leave a Reply to douyarouCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

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