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
Blog
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
Decoding
The Decoding Table Let us talk about instruction decoding. What is instruction decoding? It is the process of taking opcodes and operands and doing what they tell you. Instruction decoding is the heart of a processor emulation and in mine takes up the vast majority of lines of code. In his blog, Andre Weissflog characterises two … Continue reading Decoding
These Memories Can’t Wait
Basics Memory access is one of the most critical parts of an emulation. If memory access is slow, the emulation is slow. The Z80 does at least one memory read for each iteration of its fetch-execute loop. I chose to take the same approach as I had with the 6502 emulation, which is to say: … Continue reading These Memories Can’t Wait
Another Milestone
I’ve made two posts about the design of my emulation so far and we haven’t got very far into the nitty gritty. The actual work, though, is much further ahead. In fact, I’ve got to the first major milestone as exemplified from this log of the most recent run of the zexdoc tests. This tests […]
A Milestone
I've made two posts about the design of my emulation so far and we haven't got very far into the nitty gritty. The actual work, though, is much further ahead. In fact, I've got to the first major milestone as exemplified from this log of the most recent run of the zexdoc tests. This tests … Continue reading A Milestone
The Fetch Execute Loop
If you read any introduction to writing emulators, they all tell you to do the same thing. You write a loop that continually fetches instructions and executes them. Notice that I put the fetch after the execute. Doing so makes certain aspects of the design cleaner such as coming in to the loop first time. … Continue reading The Fetch Execute Loop
Beginnings
So I'm building a Spectrum emulation. Having done a 6502, I thought it would be fun to do something different and try to document it along the way. I'm a bit late getting going since the actual work has already progressed quite a way. Objective I want to build a functional emulator for the ZX … Continue reading Beginnings
