4
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 <register>, <address> (
store
from thisregister
to thisaddress
) - SUB <register>, <address> (
subtract
the value at thisaddress
from thisregister
)
- STO <register>, <address> (
- It also only contains
2
,32-bit
registers:A
andB
- As well as
2
,32-bit
RAM address:0x00
and0x01
- The values of
A
andB
are unknown
Challenge
Write a program to copy
RAM address 0x00
into 0x01
optimised to use the fewest
number of instructions possible.
2
Welcome to PCG! Note that this isn't a very good challenge. It's simple enough to likely only have one good solution. Try using the Sandbox for Proposed Challenges first next time to get feedback about proposed challenges. Thanks.
– mbomb007 – 2015-06-12T21:15:56.157@mbomb007 Thank you, I'm new and figured there was a better way to do this. I'm sorry for the poor question and I greatly appreciate the help. Thank you! – Brett – 2015-06-12T21:18:18.717