added an assert, changed a printf format spec, changed a comparison to be "curwrite - vm->memory >= MEMORY_SIZE"