The Apple II personal computer, which stylized as Apple ][, is an 8-bit home computer and one of the first highly successful mass-produced microcomputer products. It was designed primarily by Steve Wozniak and developed with Steve Jobs. Apple ][ was introduced in 1977 at the West Coast Computer Faire by Jobs and was sold several million times till 1993.
Maximilian Strauch is a computer scientist, software developer, web designer and maker from Germany. In 2014 he wrote about implementing a software emulator for the complete Apple ][ computer system on a single Atmel AVR microcontroller unit (MCU) in his Bachelor thesis.
The microcontroller not only emulates the MOS 6502 processor, it also performs other tasks such as output display and input keyboard. A challenging task is to get the 20 MHz AVR controller run as the 1 MHz processor.
The final result of the thesis is a fully functional, battery powered and portable Apple ][ emulator.
The layer diagram of the Apple ][ emulator consist of about 10 layers shown in the next figure.
- Emulator Runtime Environment (ERE): Contains the source code which makes up the main (backend) GUI of the emulator in particular, the menus.
- UI Framework / Display I/O: Some low level functions to control the LCD display (SSD 1289 controller) and functions to paint menus and backgrounds.
- Keyboard I/O: Accepts key presses from the separate keyboard controller and provides some high-level functions to convert Apple ][ keystrokes into regular ASCII keycodes and some wait-for-keypress functions.
- State I/O: The emulator supports saving the current state of the entire emulation including RAM and the processor registers. Therefore the execution can be saved and reloaded later to continue at the exact same execution state.
- TWI / EEPROM: Provides physical layer support to talk to an EEPROM, e.g. two functions which utilize the AVR’s hardware support for I2C to talk to the 128KB I2C serial EEPROM from Microchip.
- DSK I/O: Contains all high-level functions to read Apple ][ floppy disk images (5 1/2 inch floppy disks, normally 140 KB in total) and list that contained programs to load them into memory.
- SD Library (3rd party): The emulator uses the Petit FAT File System Module by Elm Chan since it works out of the box. A further improvement could be to store states to the SD card.
- 6502 CPU Emulation: Advanced emulation of the MOS 6502 processor without support for illegal instructions (not originally defined) and the BCD mode.