... set up loop count in Rn ...
BR 9000$
1000$:
... body of loop ...
9000$: SOBGEQ Rn, 1000$
Why branch and use SOBGEQ instead of SOBGTR? So that, if the loop
count is initially zero, the branch falls right through without
executing the body of the loop.
On 2/23/2024 10:14 PM, Lawrence D'Oliveiro wrote:
... set up loop count in Rn ...
BR 9000$
1000$:
... body of loop ...
9000$: SOBGEQ Rn, 1000$
Why branch and use SOBGEQ instead of SOBGTR? So that, if the loop
count is initially zero, the branch falls right through without
executing the body of the loop.
With the details provided then it will be pure
speculation.
n = whatever
loop:
if n <= 0 goto endloop
...
n = n - 1
goto loop
endloop:
has more instructions than:
n = whatever
loop:
...
n = n - 1
if n > 0 goto loop
but the second has the problem of not handling the n = 0
case properly.
n = whatever
goto checkfirst
loop:
...
n = n - 1
checkfirst:
if n > 0 goto loop
looks like a hack to fix that problem.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 405 |
Nodes: | 16 (2 / 14) |
Uptime: | 73:46:20 |
Calls: | 8,508 |
Calls today: | 9 |
Files: | 13,206 |
Messages: | 5,919,234 |