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> (
storefrom thisregisterto thisaddress) - SUB <register>, <address> (
subtractthe value at thisaddressfrom thisregister)
- STO <register>, <address> (
- It also only contains
2,32-bitregisters:AandB - As well as
2,32-bitRAM address:0x00and0x01 - The values of
AandBare 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