Writing

Blog

Notes from the systems layer: compilers, virtual machines, emulation, and recovering software the industry managed to lose. RSS.

Reconstructing MBASIC 5.21, byte for byte

Microsoft's source for MBASIC 5.21 is gone. A reconstruction from a sibling version and a disassembly is only half the problem. The harder half is proving the reconstruction is right, and that proof needed a byte-identical assembler to be built first.

retro z80 cp/m reverse engineering verification ai

Where the bytes go in a Z80 C compiler

uc80 compiles C for the Z80 and CP/M and produces smaller binaries than z88dk on every test of a public suite. Most of the difference comes from one decision about where local variables live — and from being honest about which part of that comparison is meaningful.

compilers z80 cp/m optimization ai

Two ways to emulate a machine

cpmemu and romwbw_emu both run CP/M software and share the same Z80 core, but they sit at opposite levels of abstraction. One intercepts the operating system, the other emulates the hardware. Neither is the better design. They answer different questions.

emulation z80 cp/m architecture ai

What to assert when the gold file runs out

Xerox shipped a reference trace for the first 499 bytecodes of a Smalltalk-80 boot. Past that there is no oracle — and the temptation is either to assert nothing or to assert too much. Both are wrong, in different ways.

smalltalk verification testing virtual machines ai

Superinstructions bought 2.8%. The profile explained why.

iOS forbids a JIT, so the interpreter in my Pharo virtual machine is the entire product. The textbook next move after computed-goto dispatch is superinstructions. Done properly, profile-guided from 100 million bytecodes, they returned 2.8% against an estimate of 15–30%. The reason is that the textbook is older than the branch predictor.

smalltalk interpreters optimization ios performance ai