Author Topic: Can label names be assigned by macros?  (Read 5182 times)

Offline T145

  • Jr. Member
  • *
  • Posts: 12
  • Country: 00
  • Hacker, Jacker & All-Around Gobsmacker
    • CodeReview
Can label names be assigned by macros?
« on: December 07, 2019, 05:18:46 PM »
I have the following macro:

Code: [Select]
; %1 = stack number
; %2 = stack size in bytes
%macro init_stacks 2
    current_task: db 0
    stacks: times (%2 * %1) db 0
    stack_status:
        status_1: db 1           ; this is for Main
        status_2: db 0
        status_3: db 0
    stack_pointers: dw 0
    %assign i 1
    %rep    %1
        dw stacks + (%2 * i)
        %assign i i+1
    %endrep
%endmacro

init_stacks 2, 256

And would like to add the ability to have the extra "status_x" labels be generated as well. Is there a way to assign label names like this in NASM?