Close

Entry 5: This Is Not the Assembly You Are Looking For

A project log for Lua2e

LUA before Lua: a self-hosting compiler on the Apple //e

jorj-bauerJorj Bauer • 09/29/2026 at 01:24•0 Comments

So, back to what's in the drive image: the myriad .S assembly files were, at first blush, not particularly interesting.

With Merlin already on the disk, and a bunch of .S files strewn around, there's nothing particularly interesting here. Yes, it's a bunch of assembly.

... for those that know 6502, that's all rather droll. She had something to do, did it, and I couldn't really care less about how. Not yet, at least.

But once I looked at HELLO.S, I became... curious.

Those are not traditional opcodes. What the heck *is* this? The 6502 has 56 instructions, which some of you will recognize on sight. Not one of those 56 is in this program.

The trick, of course, is on line 6 where she does `USE OPCODES` - a set of macro definitions that still don't mean anything to me; then line 7, the `PUT MACHINE` is an include of the entire MACHINE.S listing.

Wait a minute.

She wrote a virtual machine.

VM technology had existed in this form since the 1960s, and she wrote one in 1984, on a machine with 128 kilobytes, over a long Thanksgiving weekend, as far as anybody can tell, for fun.

For those of you that did not make a face and smell the smoke when I talked about the RIFA caps: this is not the kind of virtual machine you're thinking of. That kind is backed by a gargantuan vendor product. This is the kind that pretends to be a processor that does not exist, so you can write code for the exact computer you wish you had.

Discussions