Assembler functions. Needs to be tested in the context of the rest of the code.