Assembly Question: Indirect Reference (looping through code)
Sam Schweighart
Posts: 5
Is it possible to do an indirect reference in assembly? (I apologize if I'm using the wrong terminology)
I have a number of variables (100) starting at var1. Is it possible to create a loop in assembly, and add 1 to all of them?
Or do I have to name each variable and explicitly add one to each of them.
VS
]
Post Edited (Sam Schweighart) : 5/30/2010 3:30:15 PM GMT
I have a number of variables (100) starting at var1. Is it possible to create a loop in assembly, and add 1 to all of them?
Or do I have to name each variable and explicitly add one to each of them.
:loop add (some reference), #1 goto loop . . . res var 100
VS
add var1, #1 add var2, #1 add var3, #1 . . . var1 res 1 var2 res 1 var3 res 1 . . .
]
Post Edited (Sam Schweighart) : 5/30/2010 3:30:15 PM GMT
Comments
The place holder '0-0' ... why did you use '0-0'? Was it arbitrary? Could I just use '0' or '123' ?
Thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
When you modify an instruction to do indirect referencing, be sure to execute at least one instruction between the modifying and modified instructions (e.g. mov count, #10 and djnz count, #addIt in Mike's example). This is necessary because of the Propeller's instruction pipelining. You can use a nop if you have to.
-Phil