Here's the beginnings of my first attempt at my address decoder for my next 6502 project.
I've yet to implement the /WE out for RAM and I have a bit of an issue using the TABLE command and trying to introduce the last 4 bits of the address bus so that it tests the values properly:
Code: Select all
Name AddressDecoder;
Partno Lattice22V10B;
Date 02/04/15;
Revision 01;
Designer shalewyn.com;
Company shalewyn.com;
Assembly XXXXX;
Location XXXXX;
Device g22v10;
/*
* Lattice GAL 22V10B pinout, DIP, top view
*
* I/CLK.[ 1 24 ].VCC
* I.[ 2 23 ].I/O/Q
* I.[ 3 22 ].I/O/Q
* I.[ 4 21 ].I/O/Q
* I.[ 5 20 ].I/O/Q
* I.[ 6 19 ].I/O/Q
* I.[ 7 18 ].I/O/Q
* I.[ 8 17 ].I/O/Q
* I.[ 9 16 ].I/O/Q
* I.[ 10 15 ].I/O/Q
* I.[ 11 14 ].I/O/Q
* GND.[ 12 13 ].I
*
*
*
* $1000-$1FFF - %0001 0000 0000 0000 - %0001 1111 1111 1111
* $2000-$2FFF - %0010 0000 0000 0000 - %0111 1111 1111 1111
* $8000-$800F - %1000 0000 0000 0000 - %1000 0000 0000 1111
* $8010-$801F - %1000 0000 0001 0000 - %1000 0000 0001 1111
* $8020-$802F - %1000 0000 0010 0000 - %1000 0000 0010 1111
* $8040-$804F - %1000 0000 0100 0000 - %1000 0000 0100 1111
* $9000-$FFFF - %1001 0000 0000 0000 - %1111 1111 1111 1111
*
*
* !Pin 18 - non-swap RAM $0000-$1FFF
* !Pin 19 - Swap bank 0 or bank 1 - $2000-$7FFF
* !Pin 20 - /VIA 1 - $8000-$800F
* !Pin 21 - /VIA 2 - $8010-$801F
* !Pin 22 - /ROM - $9000-$FFFF
*
*
* Inputs
*/
Pin 1 = phi2;
Pin 2 = cpuRW;
Pin [3..11] = [A15..7];
Pin [13..15] = [A6..4];
Pin 16 = Swapbit;
/*
* Outputs
*/
/*
* Pin 18 = !selBaseRAM;
* Pin 19 = !selSwapRAMbank;
* Pin 20 = !selVIA1;
* Pin 21 = !selVIA2;
* Pin 22 = !selROM;
* Pin 23 = !WE out;
*/
Pin [18..22] = [s0..4];
/*
* Main
*/
FIELD AddressBus = [A15..4];
FIELD Selects = [s0..4];
TABLE AddressBus => Selects {
['H'0000..'H'1FFF] => 'b'100000; /* Non-swap RAM */
['H'2000..'H'7FFF] => 'b'010000; /* Swap RAM */
['H'8000..'H'800F] => 'b'000100; /* VIA 1 */
['H'8010..'H'801F] => 'b'000010; /* VIA 2 */
['H'9000..'H'FFFF] => 'b'000001; /* ROM */
}