As we know that a data is stored only in one memory location and we also know that
a data is received or transmittted through only one memory at a time. It means only one memory will be processing at a time. So RAM and ROM are connected to the same address lines. As you can see in the figure that a NOT gate has been used here. It will select only one memory at a time.
A0 to A14 pins is connected to ROM and A0 to A15 pins is connected to RAM. Pin A15 has been used for selecting the memory either it will use RAM or ROM.