Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help in Accessing Arrays in HLA

Status
Not open for further replies.

Tack24

Programmer
Oct 6, 2002
64
US
I'm using HLA and having a bit of a problem in accessing Arrays
Declaring them doesn't seem to be a problem.
But accessing it seems to throw abunch of errors

Element_Address = Base_Address + index * Element_Size

Just how the hell do you do the element_address part

i understand the 'base_address index * element_size'
but not that element_address
i've tried for example
a[1] = a + index*4;
and other ways that didn't work

how the heck do you do this? i tried the instructions on the 'Art of assembly Language' to no avail.
 
I think i got it, not sure i will paste it, someone feel free to comment an tell me if i done it right, if not tell me what i did wrong.
thanks in Advance.

program SampleArray;
#include ("stdlib.hhf")
static;

Sample: int32[9] := [0,1,2,3,4,5,6,7,8];

begin SampleArray;

mov(8,ebx); //moving element (object) 8 into EBX
shl(2,ebx);
mov(Sample[ebx],eax);
stdout.put(Sample[ebx]); //printing element in ebx

end SampleArray;
 

program SampleArray;
#include ("stdlib.hhf")
static;

Sample: int32[9] := [0,1,2,3,4,5,6,7,8];

begin SampleArray;

mov(8,ebx); //moving element (object) 8 into EBX
mov(Sample[ebx+ebx],eax);
stdout.put(Sample[ebx+ebx]); //printing element in ebx

end SampleArray;


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top