Digital Input/Output is provided
by a 6522 Versatile Interface Adapter
(VIA).
The VIA
offers two 8 bit ports, of which every line can be individually
configured to be an input or an output. Four additional
control lines are provided, and these may be set to
generate an interrupt if triggered.
Within Amélie,
it is expected that port A is used as inputs (for
sensing) while port B is used as outputs (for driving motors,
relays, etc). The reason for this is that the values present
on port A, when read, will be the true values of each
pin (regardless of its status as an input or an output), while
the values read back from port B are the latched
values.
Also contained within the VIA are two 16
bit timers. The first of these is configured to cause an
interrupt at 50Hz (or every two centiseconds). This is used to
maintain a system 'clock' and control various time-dependant
things. Once set up by the BIOS, it should be left to run and
not be touched for any reason. If the main crystal ticks
at 2MHz then value to be latched into Timer1 is
40,000. If the main crystal ticks at 1.8432MHz (i.e. the ACIA
crystal as the master source), then the value to latch into
Timer1 is 36,864. In both these cases, the VIA will
provide an interrupt exactly 50 times per second; and as the
VIA is independently free-running, drift should be minimal (no
values are available at present).
The second timer (only loosely implemented in
the emulator) is unclaimed by the BIOS and may be
used by the application code.
It should be noted that port A bits six and seven are reserved
for the implementation of a basic I˛C (or IIC) bus. This is
provided to talk to an RTC/NVRAM part, as you can see in the
picture (this is not currently supported by the emulator).
Port A was chosen for this as reading
the port will return the actual values of the pins
even when the pins are configured as
outputs.
The
little circuit shown is a Philips PCF8583P. This can act as a
real-time clock with 240 bytes of NVRAM, or as 256 bytes of
NVRAM. Salvaged from an old VCR, this part happens to be the
same as is used in the 'Archimedes' range of computers.
All
that is missing from this circuit, and the big space on the
board, is the battery - though there is no reason why two AA
cells cannot be wired in (in a holder) with a diode to prevent
accidental charging.
It is possible, however,
that the provision of the provision of the Options selector device (at &A200) will
mean that an I˛C implementation, while providing more
flexibility, is not required - at least within the first
version
of Amélie
.