Hey its CoffeeDrinker, or Asm_Happy from the old board, now using a name that I use elsewhere. Now working in Korea, and should have more time to program(In other words, I'm kinda rusty).

First Question:

I never use arrays for anything, so why doesn't this work??

Array DWORD 64 DUP (20)

I've tried serveral variations, but when I

lea eax, Array

= 0, it all equals 0. I'd like it to equal 20 so I know its working. I even checked AoA for syntax.

Now the first question pertains to my second:

Is there a way to refer to a known address by different names by scope??? I know I'm gonna need to explain that.

I declare a global array of DWORDS

now I can lea eax, globalarray

and get an absolute address for my array, say 1000h

now say I have a DWORD value at 1008h

do I have to go thru a register and

lea eax, globalarray
mov ebx,

or can I:

mov ebx,[1008h]

If I can, is there a way to alias address 1008h to a variable name?

mov ebx, MyVar (<-MyVar = 1008h as an inforamtive name.





Also, anyone else using Net as an IDE? Slick.
Posted on 2002-03-28 06:28:05 by ThoughtCriminal
You can do
mov ebx, Array[8]
-- Note the number in brackets is BYTES, not elements like C arrays

You can also do:
mov ebx, [0]
-- Although this is highly unmaintainable (add another variable to the data section and bang things aren't where you expected them to be anymore!

.data
Array dd 64 DUP (20)
.code
mov eax, Array[0]

works fine for me... Shows as 14h in the debugger, there must be some other problem.

Mirno
Posted on 2002-03-28 07:20:16 by Mirno
Thanks Mirno, I was afraid no one would understand what I was talking about.


mov ebx, Array[8] <-That should give me the absolute address
I was concerned about relocation,but it seems I do not have to be.



.data
Array dd 64 DUP (20)
.code
mov eax, Array[0]

I'll try your way. I also need to update Net with fixes.
Posted on 2002-03-28 20:36:18 by ThoughtCriminal
just did some search on arrays and found your post.
as for why it display 14h when you load the first member into eax, you declared the array as DUP(20) which is DUP(14h)...
so nothings wrong with that ;)

just wanted to tell you..
Posted on 2002-04-08 08:41:02 by phueghy
Thanks, but my problem was not a programming one, but a build problem. The file that my array was defined in was not being rebuilt with the project. Once I rebuilt everything, it worked fine.
Posted on 2002-04-08 10:14:32 by ThoughtCriminal