A Labelled Loop
Repeat work with a label and a conditional jump instead of copying blocks.
A label and a conditional jump turn a list of blocks into a loop. LBL 1 marks a spot; FN 12: IF … GOTO LBL 1 jumps back to it while a condition holds. This is where a program stops being a list of moves and starts being software.
Your turn
Your macro is called with a hole count in Q1. Using a label and a conditional jump, count from 0 up to that number in Q2, adding each step into a running total in Q10. (With 5 holes the total is 0+1+2+3+4 = 10.)
The machine gives you
5 holes:
Q1 = 58 holes:
Q1 = 8Your program is run once for each set of conditions. It has to work for all of them.
Loading...
This is a learning simulation — always prove out a program on the actual control before you cut metal.