Arduino Due just listen and read/write the 6502 pins (RW/Address/Data Bus), emulate the PIA (6821) Keyboard & Display, handle the 6502 clock and provide RAM / ROM emulation.
The project was originally implemented on an Arduino UNO that is in any case limited in terms of RAM and also less performant. Arduino Due is a perfect fit in this case.
The project is build over Platformio (http://platformio.org/frameworks) but you should be able to compile the sketch in the Arduino standard IDE too, without any change.
A 65C02S (modern version of the original 6502) is wired on a breadboard. The 6502 is a very simple kind of CPU in terms of I/O and the modern version allow us to suspend the clock at any time in LOW / HIGH state.
There are 16 Address Pins (A0-A15) each mapping a bit (HIGH/LOW) of an address word. This is how 6502 tell us which address he want to read or write to (RAM/ROM, IO dedicated address spaces). The state of this pins may change at every clock cycle.
That's it. This is all you need to interact with a 6502. The CPU expect a clock signal (HIGH/LOW) on pin 37 (PHI2). The modern version of 6502 is able to suspend any activity for an unlimited period of time during a clock cycle, both in LOW or HIGH state (was a little bit more hard with the original CPU). This make a perfect fit to let us drive the CPU via something different from a crystal, in our case, an Arduino, debug any single clock cycle and keep things in sync.
Knowing the address space where the Apple 1 was mapping the different IO (Ram / ROM / KEYB / DSP), we can simulate the external interfaces (in fact a PIA 6821) and send back & forth as needed the related data via 6502 data bus. That's it.
There are in fact 4 bytes dedicated to the PIA interface at $D010-$D013, two of them dedicated to the keyboard I/O and two of them dedicated to the Display. The Arduino sketch just hook on this addresses and react as needed (printing out to the serial monitor or sending in the pressed key), simulating the external interfaces.
The WOZ monitor asm source and the original apple 1 operation manual are two very good resources to understand how all this works.
The Arduino sketch (main.cpp) automatically load the original Apple 1 Basic in the extended RAM at E000 address (was loaded via Tape in the original version).
Same is done with a Program included in AUTLOAD array (look into programs.h).
You can comment & uncomment other programs as needed to swap them and get them auto loaded in the related RAM location.
First word in the AUTLOAD is the location in RAM when the program need to be loaded. This is not part of any original logic, it's just a convenient way to fast load programs without manually inserting them via Woz Monitor.
## MASM version of WOZ MONITOR (Official Apple 1 ROM)
Inside ASM folder you can find the woz_monitor_masm.asm source listing. This is the original ROM listing found in the apple 1 manual converted to be compatible with MASM and loaded in Apple 1 ROM.