flat assembler
Message board for the users of flat assembler.

Index > Main > Can't reference local array

Author
Thread Post new topic Reply to topic
ChrisLeslie



Joined: 04 Jun 2006
Posts: 50
Location: Australia
ChrisLeslie
Why can't I do this:

proc test
local blah[20]:BYTE
mov esi,blah
endp

I know "blah" is 20 bytes on the stack, but why cant I reference it as though it was on the heap?
Post 14 Feb 2007, 06:54
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1608
Location: Ukraine
shoorick
blah is not fixed offst but related to the current ebp, thus, should be:
lea esi,[blah]
Post 14 Feb 2007, 07:10
View user's profile Send private message Visit poster's website Reply with quote
ChrisLeslie



Joined: 04 Jun 2006
Posts: 50
Location: Australia
ChrisLeslie
Thanks shoorick. That makes sense and works fine. Smile

I also just found out that using "addr blah" with extended headers appears to achieve the same outcome.

Chris
Post 14 Feb 2007, 07:40
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.