Changed clear mem function to use a loop instead of second list and wrote data from rom file to memory.