When the class first began working on their projects, we were constantly reminded to start early so that we could finish on time. No matter how many times people hear such an instruction, oftentimes it doesn't sink in until it's almost too late. We felt that we spent a good amount of time at the beginning of this project gathering the background information on the 6502 processor, as well as the proprietary chips used in the Nintendo Entertainment System and the Atari. The reasoning behind the extensive background research was so that we didn't jump right into the coding process without knowing exactly how everything works. Had we done research to the extent that we did, but prior to the start of the month devoted to the project, then perhaps we would have realized that emulating the 6502 core was in itself a month-long task. This would have alleviated the crunch that we felt toward the end of the project, as well as softened the disappointment we both felt when we realized that the Nintendo and Atari were unattainable goals, given the time and processing constraints.
Code for some parts of our project was inspired by code of people from past projects, but all of our sources were written from scratch. Since this project was created for academic and not commercial purposes, we wish to acknowledge the fact that the MOS 6502 chip was patented by MOS Technologies in 1975.
3: To be honest and realistic in stating claims or estimates based on available data.
We certify that everything in this report and in this code is true to the best of our knowledge.
4: To reject bribery in all its forms.
No profit was or will be made from this project, as this was completed solely for academic purposes.
5: To improve the understanding of technology, its appropriate application, and potential consequences.
The goal of our project was to learn how to emulate a (ancient :-) CPU on another one, and to hopefully share this knowledge with others in the future.
7: To seek, accept, and offer honest criticism of technical work, to acknowledge and correct errors, and to credit properly the contributions of others.
Throughout this project, we've stayed in close contact with both the teaching assistants as well as the professor. We especially thank them all for their assistance and suggestions how we could 'scale down' our project to a reasonable amount of work.
9: To avoid injuring others, their property, reputation, or employment by false or malicious action.
We have followed all safety precautions for working with electrical circuitry and computers throughout the design and implementation of our project. Since we did not damage any chips or cause any fire alarms, we believe that we were successful in this.
Jeff wrote the Atmel's main 6502 execution loop and the body of the command reception system, including the interface for the simulator, wrote half of the 6502 instruction emulation, debugged and tested the emulator code, wrote and compiled 6502 assembly test files, and setup the code base and various portions of the website.
Chris wrote half of the 6502 instruction emulation, wired up all the hardware, helped implement and test the memory chip interface and Xmodem protocol, debugged and tested the emulator code, and wrote parts of the website.
All parts used for this project were already a part of Cornell's Digital Circuit Design Lab. As such, the cost of this project is negligible. Unless, of course, you factor in the cups of coffee and slices of pizza that the designers consumed in the process. :-)
There are many things that could be done to expand this project. As we stated in the introduction, our original goals were to emulate complete systems that merely used the 6502 as the processing core. The simplest one would probably be the Apple II. Addition of boot-up code and handling for the special way in which it screen dumps from memory would need to be performed to get that to work.
An Atari is a much further longshot, due to the two chips present in addition to the 6502 core. The other chips are the Stella, which handles all the video output, and the RIOT (RAM/Input-Output/Timer), which contains the only memory for the system, a hardware timer, and handles I/O with cartridges. The timing constraints for emulating the Atari are insane, due to the fact that it writes the screen on-the-fly, line by line (whee!).
Our emulator did not have functional interrupts either, which meant that BRK instructions would not work. Also, a better debugging interface would have been very useful, particularly one that would let you step through the execution and inspect memory locations. Also, our Xmodem receiver should really be using a polling loop while waiting for a file to be sent. Currently it only polls once, after a reasonable delay to give a user time to initiate the transfer from the PC.