Path: news.uiowa.edu!chi-news.cic.net!nntp.coast.net!news2.acs.oakland.edu!newshub.gmr.com!hobbes.tad.eds.com!maverick.tad.eds.com!news-admin@tad.eds.com From: Erick Wagner Newsgroups: comp.sys.apple2.programmer Subject: Re: Q: I/O 32 card from Applied Engineering Date: 5 Dec 1995 15:53:02 GMT Organization: PRC Lines: 96 Message-ID: <4a1psu$o2u@maverick.tad.eds.com> References: <49dv74$ccm@trib.apple.com> <49iui9$fgr@nnrp1.news.primenet.com> NNTP-Posting-Host: 148.94.8.235 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 1.22 (Windows; I; 16bit) Recently Dave Lyons and John Bowling asked about the AE I/O 32 card. I sent Dave some info via email but thought I should post so others could benefit from it too. >I suspect that the AE card used a couple of 6522's Good guess but wrong :) AE used a pair of Motorola 6821 chips. MicroDimensions also used the 6821 chip in at least one of their I/O boards and the John Bell Engineering board uses the 6522. If you have a choice over which I/O to use, I'd lean towards the 6522. It seems to be a little more straightforward in terms of setting it up for I/O and it has some wonderful built-in timers that can prevent you from writing some fairly complex code. Well, here's the info I sent to Dave: ====================================== Applied Engineering I/O 32 Information ====================================== If a bit in the Data Direction Register is 1, the corresponding bit of the Port is an output; otherwise, it is an input. The procedure for writing to an output is: (1) Write a 0 to bit 2 of the Control Register (2) Write 1's to the Data Direction Register of each output bit (3) Write a 1 to bit 2 of the Control Register (4) Write data to the Port The procedure for reading to an input is: (1) Write a 0 to bit 2 of the Control Register (2) Write 0's to the Data Direction Register of each input bit (3) Write a 1 to bit 2 of the Control Register (4) Read data from the Port Control Register A $C085+s0 Control Register B $C087+s0 Control Register C $C089+s0 Control Register D $C08B+s0 Examples: Reading all 8 bits from Port A LDA $C085+s0 ;Read Control Register A AND #%11111011 ;Turn off bit 2 STA $C085+s0 ;Set CRA for Data Direction LDX #$00 ;All bits are inputs STX $C084+s0 ;Set Data Direction for all inputs ORA #%00000100 ;Turn on bit 2 STA $C085+s0 ;Set CRA for Port A data LDA $C084+s0 ;Read Port A data Reading bits 0, 1, 2 from Port B LDA $C087+s0 ;Read Control Register B AND #%11111011 ;Turn off bit 2 STA $C087+s0 ;Set CRB for Data Direction LDX #%11111000 ;Bits 0, 1, 2 are inputs STX $C086+s0 ;Set Data Direction ORA #%00000100 ;Turn on bit 2 STA $C087+s0 ;Set CRB for Port B data LDA $C086+s0 ;Read Port B data Writing bits 4, 5, 6, 7 to Port C LDA $C089+s0 ;Read Control Register C AND #%11111011 ;Turn off bit 2 STA $C089+s0 ;Set CRC for Data Direction LDX #%11110000 ;Bits 4, 5, 6, 7 are outputs STX $C088+s0 ;Set Data Direction ORA #%00000100 ;Turn on bit 2 STA $C089+s0 ;Set CRC for Port C data LDA #$A0 ;Data to write STA $C088+s0 ;Write Port C data Writing all 8 bits to Port D LDA $C08B+s0 ;Read Control Register D AND #%11111011 ;Turn off bit 2 STA $C08B+s0 ;Set CRD for Data Direction LDX #$FF ;All bits are outputs STX $C08A+s0 ;Set Data Direction for all outputs ORA #%00000100 ;Turn on bit 2 STA $C08B+s0 ;Set CRD for Port D data LDA #$AE ;Data to write STA $C08A+s0 ;Write Port D data [end of document]