News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

problem allocating an array

Started by hilnius, May 15, 2012, 12:23:46 PM

Previous topic - Next topic

hilnius

Hi all,
I'm new to the asm language, and i've some problems allocating an empty array :
i examinated the code of the console "adress.asm" tutorial, which allocates an array and displays it.
Now i try to let the user fill an array, but i don't have the adress of the array i allocated (in the .data? section)
here's the code :

.data?
    myArray dd 20 dup(?)

.code
start:
    push esi
    mov esi, myArray
    print str$(esi)
    pop esi
    exit

and it prints out 0
so i don't understand why it prints 0 whereas when the array is allocated in the .data section like :

.data                         
      itm0  dd 0
      itm1  dd 1
      itm2  dd 2
      itm3  dd 3
      itm4  dd 4
      itm5  dd 5
      itm6  dd 6
      itm7  dd 7
      itm8  dd 8
      itm9  dd 9

      array1 dd itm0,itm1,itm2,itm3,itm4
             dd itm5,itm6,itm7,itm8,itm9

the same output there is 4202509 (or a number like that), which is the adress of the array !

thanks
hilnius

BogdanOntanu

Nope, it is the address of item0 ...

Try mov esi, offset myArray
Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

hilnius

well, it works...
i'll watch the doc of offset
thanks a lot
(and sorry to have chosen the wrong forum to post)