I've been redoing my memory map and decided to use a GAL for decoding, wrote up the CUPL code, programmed the GAL, hooked up some DIPs and LEDs and it works as expected. (GAL20V8B)
What's odd is when I have the GAL in place, system won't start. Logic analyzer shows OE and CE on the ROM (28C65BP getting pulled low) and address lines show FFFC, FFFD, then some random addresses, loops up to FFFE and FFFF, the back to random addresses again. If I take the GAL out of the way and just pull OE and CE on the ROM (28C65BP) to GND it works fine, so I know the issue is with the GAL being in place. I hooked the GAL output to my scope and see that it's definitely pulling them below the TTL logic low (165mV)
I'm just at a loss as to what this could be, I tried switch out for another GAL, making sure all of the unused inputs/outputs were pulled to VCC, and nothing seem to be working. I'm 100% sure it's something silly but I've been diving into this too long and need another set of eyes. This is my first time working with GALs, so I'm hoping it's a PEBKAC situation.
Here's the code for the GAL (
https://github.com/ktelep/zkt6502/tree/ ... oryDecoder)
Code:
/* *************** INPUT PINS ********************* */
PIN [9..2] = [addr15..8]; /* Incoming high address lines */
PIN 10 = p2clock; /* Phase 2 Clock for RAM */
/* *************** OUTPUT PINS ********************* */
PIN 15 = !ROM_sel ; /* OE & CE tied together, */
PIN 16 = !VIA1_sel ; /* */
PIN 17 = !VIA2_sel ; /* */
PIN 18 = !RAM_sel ; /* NAND with Phase2 clock? */
PIN 19 = !ACIA1_sel; /* */
PIN 20 = !ACIA2_sel;
/* Memory Map */
/* 0x0000 - 0x0FFF RAM */
/* 0x1000 - 0x1FFF RAM */
/* 0x2000 - 0x2FFF RAM */
/* 0x3000 - 0x3FFF RAM */
/* 0x4000 - 0x4FFF RAM */
/* 0x5000 - 0x5FFF RAM */
/* 0x6000 - 0x6FFF RAM */
/* 0x7000 - 0x7FFF RAM */
/* 0x8000 - 0x8FFF RES */
/* 0x9000 - 0x9FFF RES */
/* 0xA000 - 0xAFFF RES */
/* 0xB000 - 0xB0FF MEMORY CONTROL?? */
/* 0xB100 - 0xB1FF VIA1 */
/* 0xB200 - 0xB2FF VIA2 */
/* 0xB300 - 0xB3FF ACIA1 */
/* 0xB400 - 0xB4FF ACIA2 */
/* 0xC000 - 0xCFFF RES */
/* 0xD000 - 0xDFFF RES */
/* 0xE000 - 0xEFFF ROM */
/* 0xF000 - 0xFFFF ROM */
ROM_sel = addr15 & addr14 & addr13; /* 0xE000 to 0xFFFF Only 8k today*/
RAM_sel = !addr15 & p2clock; /* 0x0000 to 0x7FFF */
VIA1_sel = addr15 & !addr14 & addr13 & addr12 & !addr11 & !addr10 & !addr9 & addr8; /* 0xB100 to 0xB1FF */
VIA2_sel = addr15 & !addr14 & addr13 & addr12 & !addr11 & !addr10 & addr9 & !addr8; /* 0xB200 to 0xB2FF */
ACIA1_sel = addr15 & !addr14 & addr13 & addr12 & !addr11 & !addr10 & addr9 & addr8; /* 0xB300 to 0xB3FF */
ACIA2_sel = addr15 & !addr14 & addr13 & addr12 & !addr11 & addr10 & !addr9 & !addr8; /* 0xB400 to 0xB4FF */