The Dragon 64 VDG "glue logic" transcribed into VHDL. Xilinx ISE reckons it's ok? And GHDL builds it... It would replace 9 chips if it worked...
https://gitlab.com/sixxie/dragon64-pal/
Anyway, it's commented, so it should at least help understand the schematic...