You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
93427 OR EQUIV ROM<br />
ADDRESS<br />
BUS<br />
1---- D7<br />
..-----'''- 256 x 4 1---<br />
ROM<br />
1---- D4<br />
TO DATA BUS<br />
256 x 41---+-+-<br />
ROM<br />
D3<br />
DO<br />
R/W ---t :::o---+ ...._ _ __.<br />
l/O SEL ---<br />
Fig. 7-11. A 256-byte memory expansion circuit diagram.<br />
oved the card to another interface slot, the addresses for the<br />
USART would change, as noted in Table 7-3.<br />
To use the USART interface, you must first initialize the chip with<br />
me control information that is sent as two consecutive bytes to the<br />
ontrol register. Don't worry about sending two bytes to the same<br />
gister, the USART "knows" what to do with them. After the<br />
SART has been initialized, you can use it to transmit and receive<br />
synchronous-serial streams of information. The program shown in<br />
xample 7-1 can be used to transmit an 8-bit byte of data, while the<br />
rogram shown in Example 7-2 c be used to receive an 8-bit byte.<br />
POKE 49328, TX<br />
WAIT 49329, l<br />
RETURN<br />
WAIT 49329, 2<br />
RX =<br />
RETURN<br />
Example 7-1. USART Transmitter Control Subroutine<br />
Example 7-2. USART Receiver Control Subroutine<br />
PEEK(49328)<br />
e software checks the necessary flags so that the transmitter trans<br />
•ts its data only when it is ready, and the receiver only provides<br />
ata when it has actually received some.<br />
The main point here has been to develop a simple interface that<br />
ses many of the Apple bus interface control signals, so that you can<br />
e how they work. It is also nice to know that the interface example<br />
ctually works, and that it can be used in some real applications. We<br />
ope that you have seen how easy it is to develop an interface for<br />
e Apple, based upon the concepts of port addressing, port control,<br />
nd flags, that we introduced throughout the book.<br />
179