At the end of my previous post, the spectrum was at the point where it would boot up and display the Sinclair copyright statement on the screen. Nothing else would happen and, indeed, you had to manually force the screen to refresh to get anything at all to display. Since then, it has now been … Continue reading Synchronising the Screen
Category: Z80
Beginning the Spectrum
So I got bored of implementing instructions and decided, instead, to start implementing the actual Spectrum. This may seem a bit presumptuous, but it's more fun than just slogging through implementing instructions that nobody ever uses. To start, I decided to reuse the main window and memory window from my Z80Diagnostic app. This meant refactoring … Continue reading Beginning the Spectrum
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 […]
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