Reimplemented memory.sp

Memory is no longer allocated contiguously!
Added a bunch of macros.