User`s manual

Appendix B: Theory of operation.
The Apple II Pi computer runs as two parts: the Apple II's 6502 processor is running a special device
driver under BASIC in ProDOS. This device driver sends keyboard and mouse events to a special
background process running in Linux on the Raspberry Pi, known as a daemon, accepting the input
events from the Apple II and inserting them into the Linux input subsystem where they are made
available to applications.
A2PI:
When the Apple II is turned on, the Raspberry Pi begins its boot process in parallel with the Apple II
boot procedure. The Apple II will run the STARTUP program on the A2PI floppy, load the A2PI driver,
and wait for the daemon to establish a connection. The A2PI driver will then hook the I/O vectors and
return. The STARTUP program exits, leaving the Apple II awaiting user input. Inside the input
routine, control is returned to the A2PI driver, which forwards keyboard and mouse events to the
Raspberry Pi, and responds to requests from software running under Linux. Because the Apple II
thinks it is simply waiting for user input, the A2PI driver can inject characters as if it came directly
from the keyboard – even if it came from a Linux program! Run a2term to see this in action.
a2pid:
On the Raspberry Pi, Linux will automatically start its list of services, one of which is the Apple II Pi
daemon: a2pid. When the a2pid daemon synchronizes with the Apple II client, the Apple II will give its
familiar beep, and the two computers will become one. Linux will complete the boot process and
present the 'login:' prompt at the console for the user to log in. Other Linux drivers and programs, such
as the joystick driver and the file-system driver, will connect to the Apple II through the a2pid server.
a2pid is the traffic cop, directing all program requests down to the Apple II and returning the results.
Memory ranges on the Apple II can be read and written, as well as control passed to routines on the
Apple II. This protocol, and the interface for external tasks, is what gives the Apple II Pi the ability to
provide many different functions of the Apple II to programs running on the Raspberry Pi, all
apparently simultaneously.
26
26