static array in asm

Programming, for all ages and all languages.
Post Reply
psnix
Member
Member
Posts: 50
Joined: Fri Oct 24, 2008 12:34 pm

static array in asm

Post 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.
bontanu
Member
Member
Posts: 134
Joined: Thu Aug 18, 2005 11:00 pm
Location: Sol. Earth. Europe. Romania. Bucuresti
Contact:

Re: static array in asm

Post 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
Ambition is a lame excuse for the ones not brave enough to be lazy; Solar_OS http://www.oby.ro/os/
Gigasoft
Member
Member
Posts: 855
Joined: Sat Nov 21, 2009 5:11 pm

Re: static array in asm

Post 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
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: static array in asm

Post by Love4Boobies »

This question is very inappropriate because it tells us you have no clue how static works.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
Post Reply