Page 1 of 1

static array in asm

Posted: Thu Apr 22, 2010 2:44 pm
by psnix
hi

how can i define static array in asm (c-like), i want to hold pointer to functions in array

for example in C i do this:

Code: Select all

static isr_routine routines[256];
but how can i define it in the assembly.

Re: static array in asm

Posted: Thu Apr 22, 2010 2:51 pm
by bontanu
It depends on the assembler you are using:

In my assembler Sol_Asm (free for OS DEV)

Code: Select all

.data
 isr_routines  rd 256         ; reserve dwords [256]
.code
In MASM:

Code: Select all

.data
 isr_routines  dd 256 dup(?)
.code
I will let the others complete this two examples with other more commonly used assemblers like FASM and NASM. A simple read of your assembler's manual should provide this kind of information.

PS.
You can find my SOL_ASM assembler and the manual here: at http://www.oby.ro/sol_asm/index.html

Re: static array in asm

Posted: Fri Apr 23, 2010 8:55 am
by Gigasoft
In MASM, one can also declare arrays of structures as:

Code: Select all

Label StructureName Count dup (<>)
In NASM, one uses the resb, resw or resd directives, such as:

Code: Select all

Label resd Count

Re: static array in asm

Posted: Fri Apr 23, 2010 9:30 am
by Love4Boobies
This question is very inappropriate because it tells us you have no clue how static works.