Last weekend I eliminated the last Swift from the interpreting loop. There are now two pre-predefined words: an outer loop that reads a line of text and calls the the interpreter from the last post and the inner loop that interprets words from a line. The code for each looks something like this: : .readLoop … Continue reading Forth Interpreting Itself adDendum
Category: refactoring
The Forth Protocol
In which I accidentally discover a performance enhancement I'm really not a fan of the massive switch statement at the heart of the execution loop, so I have decided to see if I can do something with virtual functions or closures on a WordList. The execute function would be reduced to running a particular function … Continue reading The Forth Protocol
Forth and the Furious
In which we go faster This is a bit of an interlude. At this point, I've built a serviceable computing engine that's not quite a Forth implementation but is capable of any computation. We can now look at refactoring some parts of it with respect to increasing performance. At the same time, we want to … Continue reading Forth and the Furious
Metal And Emulation
I thought it was time to learn how to do programming using the GPU. On macOS, that means Metal. I started by following this tutorial. Once I got to about tutorial number 11, I started wondering if I could apply Metal to my emulators. I thought, it would be cool if all of the graphics … Continue reading Metal And Emulation
The Refactoring Results
So I completed the refactoring of the instruction decoding to allow two sources and two destinations. I'm pretty pleased with the results. It's allowed me to completely eliminate several operations from the decoding code. All the jumps, calls and returns (except RETI, which is not implemented yet and RET cc which requires the stack to … Continue reading The Refactoring Results
Some Refactoring
Whilst I was writing my post about instruction decoding, a thought struck me about improving the structure of decoding. In the existing decoder, I do four things: Get the displacement, if needed Get the source operand, if needed Do the operation Save the result to the destination if needed This works fine but the "do … Continue reading Some Refactoring