Part 3: VIA (Versatile Interface Adaptor) Testing
(CLICK TO ENLARGE)
VIA Wired into BB 6502 Assembly 6502 Binary Bus Capture Video: Alternating LEDs
6502 Assembly Video: Cylon LEDs
Eagle: Schematic Eagle: Board Layout Gerber Viewer: PCB Layout
What is a VIA?
The W65C22 versatile interface adapter (VIA) is an input/output device for use with the 65xx series microprocessor family. We'll use most of the I/O as output and some as input.
When a 6502 machine language/assembly language instruction is sent to any address less than $8000, it is considered to be for the RAM, VIA, ACIA/UART, etc. and not for the ROM ($8000 to $FFFF).
In our ROM/RAM select logic in the schematic, pins A15 low, A14 high and A13 high will choose any address between $6000 and $7FFF . With the VIA's RS0 to RS3 pins connected to A0 to A3, respectively, the specific addresses will be $6000 to $600F. Because our address selection logic is very simple, a lot of addresses will be unused but that's fine for our initial design; we'll refine the addressing later.
The top left adjacent screenshot shows the labeled leads from the VIA to the buses.
The versatile interface adaptor contains two banks of 8 addressable pins. Bank B will be for the 4x20 LCD data lines and Bank A will be for its control lines like E, R/W and RS.
For our initial testing purposes, we'll wire 8 LEDs from PB7 to PB0.
Testing the VIA
We performed the following:
- wired the VIA into the BB
- wrote the 6502 Assembly code using our fave editor
- assembled the code into a 6502 machine language binary using DASM (dasmj.bat filename)
- displayed the machine language code using HxD
- burned the binary into the ROM using our MiniPro programmer
- tested the output by capturing (using an Arduino Mega2560) the 6502's boot and code execution
- video'd the LEDs alternating between the 0x55 and 0xAA patterns
You can see all of this in the top five screenshots (click to enlarge).