Assembly: Get address

admin

Administrator
Staff member
Hi<br /><br />I've started to learn assembly yesterday (AT&T syntax) using AS and Linux. Now I try to get the address of a list of numbers at a specified index<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><br />.section .data<br />numbers: .long 1, 2, 3, 4, 6<br /><!--c2--></div><!--ec2--><br />$numbers seems to return the address of the begin of the list. So I tried this<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><br />#set index to access<br />movl $0, %edi<br />movl $numbers(, %edi, 4), %ebx # movl $numbers, %ebx works.<br /><!--c2--></div><!--ec2--><br />however this didn't compile. So my question is: What's the syntax to do this. The equivalent in C would be &(a[edi]).<br /><br />Thank you very much <img src="http://static.dreamincode.net/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
</div>
 
Back
Top