Pelles C forum

Assembly language => Assembly discussions => Topic started by: Vortex on May 24, 2023, 08:17:44 PM

Title: FOR macro
Post by: Vortex on May 24, 2023, 08:17:44 PM
Here is a simple FOR macro for Poasm to handle more effectively the loops :

Code: [Select]
ForCounter = 0

FOR_ MACRO var,init,_end

    mov     var,init

    ForCounter=ForCounter+1

@CatStr(<Cnd>,ForCounter)= _end

@CatStr(<ForLoop>,ForCounter) :

ENDM

NEXT MACRO var

    inc     var

    cmp     var,@CatStr(<Cnd>,ForCounter)

    jbe     @CatStr(<ForLoop>,ForCounter)

ENDM