Quick'n dirty schematics:
As per AY pinout:
1- GND
2- NC
3- Audio B
4- Audio A
5 to 21 are left disconnected (2x 8 bit GPIO ports)
22 - CLK
23 - NC ( This is Reset pin. One can leave this pin floating as it has a internal pull up and this chip does not require as reset for being simply an state machine.)
24 - GND
25 - VCC
26 - NC
27 - BDIR
28 - PRG A13 (A13 from FC Connectgor, not mapper chip)
29 - GND
30 - D7
31 - D6
32 - D5
33 - D4
34 - D3
35 - D2
36 - D1
37 - D0
38 - Audio C
39 - NC
40 - 5V
ALL ADDRESS LINES AND CONTROL SIGNALS are meant to be taken from the FC slot side, not from the MAPPER outputs side.
The resistor values do not reflect the values of a original cartridge but the output are expected to be similar. If you are planning to use this on a NES you don't need to implement the complete sound return circuitry so just the three 1K resistors and the 3K3 resistor to GND would be enough.
Edit: Repaired picture links.