Move memory_map_[read|write] and reg to memory.c

This is not MIPS-specific, is defined in memory.h and used
everywhere in memory.c, so it'd better be in memory.c

Plus, it seems to fix a segmentation fault (related to alignment?).