NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: Crysein on August 21, 2021, 03:53:36 PM

Title: [SOLVED] "times" macro advanced use
Post by: Crysein on August 21, 2021, 03:53:36 PM
Hello,

Is there a similar way to do such thing ?

Code: [Select]
Paging1GBTable:
;{
    .PML4: times 512    dq 0    ; Page Map Level 4, each address is pointing to a single PDPT
   
    .PDPTList:
    ;{
        times 512               ; 512 PDP Tables
        (
            times 512   dq 0    ; 512 address pointing to a 1 Gbyte physical page
        )
    ;}
;}
EndPaging1GBTable:

I know that I could just do
Code: [Select]
times 512 * 512 dq 0

But I prefer the first code style for the sake to be more human language friendly.

Btw doing the below code do nothing, it's like writing times 512 dq 0
Code: [Select]
times 512 times 512 dq 0
Title: Re: "times" macro advanced use
Post by: debs3759 on August 21, 2021, 09:18:20 PM
Other than

times 512 * 512 dq 0

The only alternative I can see would be to do something like:

Code: [Select]
%rep 512
    time 512 dq 0
%endrep

but I think that would take longer to assemble. I haven't tested it to confirm that %rep and times work together.