I looked at the interpreter source, but didn't see any comments related to non-variable finite loops. But I suspect they're the same as variable-based finite loops, but with an internal variable. So it's probably necessary to examine the byte code produced for a definitive answer. Either that, or set up a counter and wait a few hours for the result.
In any event, I suspect the short answer is, "One more time than repeat -2."
Yep, it behaves exactly like a DJNZ...check out the attached source.
* An empty repeat loop takes about 224 clocks per pass
* So, at 80MHz, the counter variable would be changing at a rate of ~357000 per second
* Monitoring Hub RAM for values that changed at that rate found the counter
* watching the counter showed that it starts at whatever value you specify, so
* starting at -1 will keep going negative at that specified rate, terminating one the counter reaches 0
* at 80MHz, it will take about 3.34 hours to complete an empty "repeat (-1)"
I ran this under SpinSim, and the debug listing is shown below. It loads a -1 on the stack, and first tests for zero. It then executes a djnz until it reaches zero. The stack pointer and the value at the top of the stack are shown in columns 2 and 3. The columns after the "-" are the program counter, bytecodes and the instruction mnemonic. The number after the tjz and djnz instructions is a jump offset.
Comments
A long time ago I tried repeat... step -1 and got completely unexpected behavior....
In any event, I suspect the short answer is, "One more time than repeat -2."
-Phil
As far as I know this is a feature that is unique to Spin:-)
@heater - your joking right?
Might be:)
* An empty repeat loop takes about 224 clocks per pass
* So, at 80MHz, the counter variable would be changing at a rate of ~357000 per second
* Monitoring Hub RAM for values that changed at that rate found the counter
* watching the counter showed that it starts at whatever value you specify, so
* starting at -1 will keep going negative at that specified rate, terminating one the counter reaches 0
* at 80MHz, it will take about 3.34 hours to complete an empty "repeat (-1)"
Jonathan
(Why doesn't parallax document this...)
-Phil
So far I know the repeat occurs more than 100,000,000 times (I left a program runing while reading the forums). I think lonesocks answer is better.
Dave