In which I write a simple word parser My project for the weekend is a Forth interpreter. I stumbled across a web site that tells you how to write one. I say "interpreter" because a compiler involves messy things like machine code and I don't want to go there just yet. Exercise 1 Read Forth … Continue reading May the Forth be With You
Category: Emulation
Time for a C64
Now I've mastered Metal (ha ha), I think it's time to build an emulation that's a little more complex. It's time for the Commodore 64. Yay! Had some thoughts about how to do this. The extra challenges that I see are: the banked memory. I will need to be able to swap the RAM/ROM banks … Continue reading Time for a C64
Metal Addendum
In my last post, I discussed how I used Metal to render the PET screen instead of the higher level Cocoa APIs. I did the minimal amount of work to make the changes, so the program actually worked very inefficiently. The 6502 has no separate IO space so all peripheral control registers are mapped into … Continue reading Metal Addendum
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
Synchronising the Screen
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
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 […]