Hi guys
I've set up my 6502 system which reads from EEPROM and read/writes to RAM ok.
The next stage is to set up the 6522 (in fact 65C22S-14) VIA. Unfortunately my efforts result in no lit LEDs. Is this because I need to somehow latch the outputs of the VIA? Perhaps with CA1 or CA2? If so I thought CA1/2 were for latching inputs.
I've connect it and written a simple program - see below.
Connections (for testing purposes it's been set up the same as the primer demo:
http://wilsonminesco.com/6502primer/potpourri.html#BAS_CPU):
RS0 = 6502 system address bus line A0
RS1 = 6502 system address bus line A1
RS2 = 6502 system address bus line A2
RS3 = 6502 system address bus line A3
CS1 = 6502 system address bus line A13
CS2B = select using NAND gate logic per the primer demo
PHI2 = System clock (65C02 PHI2 & Oscillator)
RESB = To the reset button debounce circuit
D0 to D7 = 6502 system data bus D0 to D7
PA0 to PA7 - LEDs & 1K resistorsPB0 to PB7 - not connected (yet)
CA1 - not connected (yet)
CA2 - not connected (yet)
VSS - GND/0V
VDD - +5V rail
My (simple) code:
Code:
REM -- initialisation
P%=OSstart
CLC
SEI
CLD
.VIAprep
' enable A as output [all bits=1, all lines=output]
' 1111 1111
LDA#&FF
' rs pattern = 0011 [&03]
STA &6003
' display a bit pattern of 10101010 [&AA]
LDA#&AA
' rs pattern = 0001 [&01]
STA &6001
JMP VIAprep
This should light 8 LEDS attached to PA0 to PA7 of the VIA (via 1K resistors), but it doesn't. Have I gotten this wrong?