Copy Memory Only Using Store And Subtraction A peer of mine approached me with this challenge and I wasn't able to come up with an elegant solution. After discussing my approach, we began to wonder what the people at Code Golf would come up with.

Given


A processor that implements only two instructions:


STO &lt;register&gt;, &lt;address&gt; (store from this register to this address)
SUB &lt;register&gt;, &lt;address&gt; (subtract the value at this address from this  register)

It also only contains 2, 32-bit registers: A and B
As well as 2, 32-bit RAM address: 0x00 and 0x01
The values of A and B are unknown


Challenge

Write a program to copy RAM address 0x00 into 0x01 optimised to use the fewest number of instructions possible.
Assuming registers are signed and/or wrapping

8 instructions:

STO A 0x01
SUB A 0x01
SUB A 0x00
STO A 0x00
SUB A 0x00
SUB A 0x00
STO A 0x00
STO A 0x01


A 7-instruction version provided by lrn:

STO A 0x01
SUB A 0x01
SUB A 0x00
STO A 0x01
SUB A 0x01
SUB A 0x01
STO A 0x01