PDA

View Full Version : Loops in assembly



The Master
- 8th July 2010, 14:36
Hi, i was wondering if its possible to create a loop in assembly. I already know how to use GOTO to create a runtime loop but im looking to create a loop that is executed while the code is compiling and results in multiple lines of assembly being output.

Example:


for x=0 to 5
MOVFF var+x, var2+x
next


And the actual assembly code i would expect is:


MOVFF var+0, var2+0
MOVFF var+1, var2+1
MOVFF var+2, var2+2
MOVFF var+3, var2+3
MOVFF var+4, var2+4
MOVFF var+5, var2+5

Jerson
- 8th July 2010, 14:59
Have you seen this thread? Might have the answer to your question.

http://www.picbasic.co.uk/forum/showthread.php?t=12124&highlight=delay+cycles

The Master
- 9th July 2010, 11:55
I read through that thread and found while/endw. That does the job perfectly. Thanks :)