Programming, for all ages and all languages.
psnix
Member
Posts: 50 Joined: Fri Oct 24, 2008 12:34 pm
Post
by psnix » Thu Apr 22, 2010 2:44 pm
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:
but how can i define it in the assembly.
bontanu
Member
Posts: 134 Joined: Thu Aug 18, 2005 11:00 pm
Location: Sol. Earth. Europe. Romania. Bucuresti
Contact:
Post
by bontanu » Thu Apr 22, 2010 2:51 pm
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
Gigasoft
Member
Posts: 855 Joined: Sat Nov 21, 2009 5:11 pm
Post
by Gigasoft » Fri Apr 23, 2010 8:55 am
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:
Love4Boobies
Member
Posts: 2111 Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania
Post
by Love4Boobies » Fri Apr 23, 2010 9:30 am
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 ]