Each asterisk represents 8 other instructions passing before seeing that instruction. Here's a graph of each of the first fifty-two instructions seen for the first time, how many instructions were executed before it, and a little bar graph to help visualize that. That kind of amplification of effort was pretty exciting! The fifty-second instruction got me through 45000. The forty-second instruction got me through another 70 cycles. The sixteenth instruction I implemented got the machine through 10 more cycles before I had to implement a new instruction. But pretty quickly the progression became geometric (possibly even exponential or tangential, see below). The first five new instructions occurred right away in the execution sequence. I think Lawrence suggested this based on his TRS-80 emulator project.Īt first, I had to write a new case statement just to execute one more machine cycle. I imagined that writing a huge table-based CPU emulator before executing even one instruction might have killed my interest, so I wrote the instruction decode switch basically "on-demand." If the while-loop read an instruction that I hadn't implemented yet, the program would print the hex byte for the instruction and exit. I opened "apple2e.cpp" in vim on Saturday, November 5th, 2016, and made my first substantial push to Github implementing about 28 instructions around 1 AM that night. As an aside I wanted to learn some C++11 constructs including range-for, chrono, and lambdas. I think my intent was to shake off cobwebs and write something by myself (with my friends' help as available) that I could enjoy as a way to visit that old machine. I figured I'd start with main() containing just fopen() and fread() to get the ROM into an array of unsigned char and a switch statement for decoding instructions stuffed into a while(true). I decided to start with nothing but a compiler and the ROM file from our Apple //e. In the previous year, with Lawrence Kesteloot I had built a Z-80 computer then built an ARM tablet and ported some ancient K&R C graphics demos to it, and I guess I really caught the retrocomputing bug. In November 2016, a little burnt out during a pass of restructuring and cleaning-up my old code, I was looking for something fun to write from scratch. I had more important things to do, you know? Implementation I didn't have much interest in revisiting old computers at the time. In 2010 my brother, Bart, extracted verbatim byte images from all of the old Apple ][", but then shelved it all. The //e moved to the basement and gathered dust except the occasional nostalgic boot. I spent a lot of time upgrading myself from 6502 assembly and BASIC and a monochrome display to C and actual color. I remember loving it so much, but then we got an Amiga 500. It was really the first computer I started programming in earnest. Please take a look at VICE – Versatile Commodore Emulator instead.Ĭopyright (c) 2017 Gianluca Ghettini (C++ implementation)Ĭopyright (c) 2017 Dennis D.I wrote a partial Apple //e emulator. This C64 emulator is just a very basic 6502/6510 emulation example and is not feature complete. The C64 Emulator uses a symbolic keyboard translation thus any keyboard layout should work. Install the commodore CBM.ttf font found in the VICE package.
Apple2 6502 emulator download#
You need to download the BASIC ROM and the Kernal ROM and put both files inside the ROMs folder. The 6502 functional test (version 1) by Klaus Dormann is included.Ī very basic C64 emulator is included. The port was written with minor changes to the original file: the run(N) function was replaced by a single Step() function – if you need to run more than one cycle, just put that function inside a loop. Download current version at GitHubMain features: