Building an Apple 1 emulator in Rust
Building an emulator is a common project for developers. It requires a thorough understanding of the system you're trying to emulate, along with enough programming know-how to create a system that's effective.
When I started this project in 2022 I felt like I had neither of those things. What I did have however was an unhealthy interest in old CPU's and a passing interest in the Rust programming language. And after some attempts of writing the emulator in C++ I decided to switch over to using Rust. Multiple rewrites, and almost a year of going back- and forth with development. It almost in a fully working state. A pure rust implementation of the Apple 1 personal computer.
The Apple 1
The Apple 1 is, on a very basic level, a hacked-together version of the much more popular Apple 2. While both computers share the same processor, you can find significant differences in the periperals of each computer. The Apple 1 could only show ASCII characters from it's shift registers. While the Apple 2 could display coloured graphics.
Notes on Rust
The low level features of the Rust programming language make it a great candidate for these types of projects. Especially considering the huge amount of bitwise operations happening in a 6502 processor. The strict typing and borrow-checker feature also prohibits you from shooting yourself in the foot when dealing with design patterns. Dealing with both of these was a great learning experience, And in my opinion, it did pay off. When I run my emulator at uncapped speed it's three times faster than the 1Mhz frequency of the original processor.
Source code
The code for this project can be found on my GitLab page