Question: A computer has three registers, A, B and R. It has only three instructions:
A->R : Load R with A
B->R : Load R with B
A-R->A : Subtract R from A and store the result in A
Using these instructions how can you do the follwoing?
B->A : Load A with B
Solution:
A->R
A-R->A // at this point A is zeroed out
B->R
A-R->A // A == -B
A->R // R == -B
A-R->A // A == 0
A-R->A // A == B