Add helper functions for updating registers and memory.