Tuesday, October 27, 2026

An old dog learns a new-ish trick?

For those that aren't aware, I retired from Red Hat earlier this year. I was there for almost 22 years, most of which were both pleasant and rewarding for me. The exceptions were the final 2 or 3 years, during which I was constantly a bit annoyed by the dogged pressures from upper management to integrate AI into my workflow even when I saw no place for it or I judged that there was little or no value in doing so for my particular tasks or duties. Since regaining full mastery of how my skills are utilized and how my time is spent, I have continued to be aware of the growing use and influence of AI tools in my areas of interest both professionally and in the retrocomputing hobby.

Over time I  developed a nagging feeling that my overall lack of interest in AI tools was leaving me with an experiential gap which was separating me from my peers. I began to consult various friends from my professional life and collecting their advice and opinions on how best to make use of AI tools, particularly the well-known Claude Code. Since hands-on learning tends to yield the best results, I decided that I should pick a hobby-related project to use for my learning experience. All that and a reasonable token allowance allowed me to produce1 a Linux-based compiler for the PL/M programming language which targets the Motorola 6809 processor.

Why A PL/M Compiler?

For some time I have had an interest in programming tools for retro computing targets, but there is really no community need for yet another assembler or even another C compiler. Programming Language for Microcomputers (PL/M) is a high(-ish) level systems programming language originally conceived to support early microprocessors from Intel. This role yielded a language which reminds me quite a bit of C, but without the decades of accumulated baggage and expectations. IMHO, the language maps reasonably well to the capabilities of my favorite vintage CPU, the 6809. Hopefully the availability of this language will be welcomed by the existing communities of 6809 users, particularly that surrounding  the Tandy Color Computer.

Working With Claude

The collected advice from everyone came down to two points: a) be specific about the desired outcome without specifying how to achieve it;  and b) treat the AI like one would treat an intern (i.e. someone skilled and competent, but distracted and inexperienced). With that advice in mind, I gave Claude the following prompt:

Project goal is a Linux-based compiler for a minimal version of the PL/M language which outputs 6809 assembly language compatible with the lwasm  assembler toolchain.

After that, Claude asked a handful of clarifying questions. This included some specifics to help define what a "minimal verion of the PL/M language" meant, and some other minor clarifications. After a little time burning tokens, Claude showed me what it had for a plan and asked me to approve it. Initially I asked Claude to allow me to approve each change, but soon I was comfortable enough to let it proceed in automatic mode. I asked Claude to generate PDF documentation for the main binaries and to keep both the docs and the Claude.md file up-to-date with each subsequent change to the project.

How Did Claude Do?

I admit to having been extremely skeptical about what Claude would produce. Early experiences with various AI tools had been embarassingly disappointing, so I anticipated something that would at best mimic the assigned task. But instead, I was pleasantly surprised. Claude produced both a tool that compiles PL/M source code down to 6809 assembly language and a command-line 6809 simulator capable of running 6809 binaries which is used to run all of the compiler tests which Claude produced as part of its development process. Claude also built a system to provide runtime support for different machine targets, including the Tandy Color Computer and an example target for a user to customize for other targets. At my prompting, Claude provided targets for OS-9 and FLEX as well as the simon6809, the kswitchit 6809 kit, and Grant Searle's 6809 design. I have had limited opportunity to toy with the results so far, but so far I am quite pleased. Claude was even able to produce an RPM file suitable for Fedora!

Where Are The Results?

The git tree for the resulting PL/M compiler for 6809 is here:

https://github.com/retrotinker/plm09
 The PDF documenting the compiler is available here:

https://github.com/retrotinker/plm09/blob/master/docs/plmc.pdf 

And the PDF documenting the simulator is here:

https://github.com/retrotinker/plm09/blob/master/docs/sim6809.pdf 

Finally, Fedora users can use the RPM here:

plm09-0.2.0-1.fc44.x86_64.rpm 

Conclusion 

So, there you have it! I believe this tool is suitable for play/testing by retro computing enthusiasts with an interest in PL/M and/or the Motorola 6809, particularly if that enthusiast has a Tandy Color Computer, or one of the other supported targets. Someone suitably skilled and motivated could even extend the example runtime support for their own custom target. Finally, Fedora users can use my pre-built RPM for their own testing.

Please do give the tool a try and let me know what you think, or if you find any problems! I look forward to hearing from you in the comments!


1 I think "produce" is the correct term. I wrote essentially none of the actual code, but merely specified what I wanted from Claude and any additional changes which I wanted along the way. ↩

No comments:

Post a Comment