In which our protagonist proves how amazingly productive procrastinators can be, unless color choices are involved.
Remember last time we talked about switching from the 6502 to the 65816, and that we'd have to write our own assembler and emulator? Well, it turns out that there is a reason that the world is not overflowing with emulators for a 8/16- bit hybrid chip with a banked memory structure and emulation/native modes: It's complicated, to the point where we're already dealing with questions the experts describe as "esoteric" and have to test on actual hardware to answer. That is never, ever a good sign.
So my chips are gathering dust in a box while I'm writing the emulator from hell.
Forth code from the crude65816. In which other language can you get away with naming a function "24>lsb/msb/bank" ?
But wait, how do you test an emulator? You need an assembler, because hand-assembling test routines will drive you insane. So we set the emulator aside and upgrade our Typist's Assembler for the 65C02 for the 65816. As a nice side effect, we can replace some of the most confusing mnemonics (PEA becomes PHE.#), and there is none of this "LDA <$123456" or "LDA !$32" stuff.
A simple testing routine for the emulator in Typist's Assembler. Loop names get silly when the hours get long.
But wait, normal Forth syntax highlighting looks like crap in vim for assembler. So we set the assembler aside and write a vim syntax plugin for Typist's Assembler.
Code from the vim plugin for Typist's Assembler. I am not willing to discuss how much time I spent deciding which colors to use.
Back to the emulator? Not so fast, because we really should have a test suite for it. Because this is Forth, it is simply an add-on (accessed by INCLUDE CRUDETEST.FS after loading the emulator). Because I'm easily amused, we display the result of the test run in a matrix.
Early test run of the matrix of results from the test suite for the emulator. Note the complete lack of spoons.
After all of that, how far along is the emulator? In pre-ALPHA with maybe a third of the opcodes working. Since I went for the simple instructions first (duh), it's only going to get harder from here on out. In other words, this is going to take a while, quite possibly till the end of the year.
Still, we can dream. In the next entry, we'll get back to the overreaching design plans for the Übersquirrel Mark I and that bad Mass Effect joke I promised.