Page 1 of 1

Assembler Loop

Posted: Sat Jan 08, 2005 7:50 pm
by martin66119
Code updated For 5.20+

I try to write a loop in assembler. (e.g. PB example

Code: Select all

For i =10 to 100 
nect i
Is there someone that give me an example that work in PureBasic 3.92 DemoVersion.
Thanks a lot for your help

Posted: Sat Jan 08, 2005 8:16 pm
by thefool
Code updated For 5.20+

pretty simple. Enable inline asm ;)

Code: Select all

i=10  ;Defines what initial value to run from

myloop:
;************
;CODE HERE!
;************
INC i        ;Increase i by 1
CMP i,100    ;Compare and set a flag
JNE l_myloop ;Jump If Not Equal (looks if what the flag value is)

;This is after the loop.

Posted: Sat Jan 08, 2005 9:00 pm
by Paul
Code updated For 5.20+


and here is if you do not want to enable inline assembly...

Code: Select all

i=10 

myloop:
!INC [v_i]  
!CMP [v_i],100 
!JNE l_myloop