Associating ROMs and RAMs
Counting the number of memory cells in both RAMs, four 512x4 RAMs are required to build one 1024x8 RAM. 
9 address lines A0-A8 are required to address one 512x4 RAM. 
Cascade the data lines of two such 512x4 RAMs to obtain one 512x8 RAM.
Now cascade two such 512x8 RAMs to obtain one 1024x8 RAM. 10 address lines are needed to address one 1024x8 RAM. So you can set the 10th address line A9 as enable (using a not gate or simple 1X2 decoder) to select one of the two 512x8 RAMs. 


Something like: