Subject: Accessing Array from ASM passed from C++? · Posted: 2006-11-26, 05:21pm
Rank: ? (1)
Member #: 29207
I've been studying assemby for about a semester now. I am having a horrible time figuring out how to access the array of data I pass from C++ to ASM. It is a array of strings which I will have to sort in ASM and return a sorted array back to C++. The biggest problem I am having is accessing the data itself. The array is being passed at [ebp+8]... Any help with this is appreciated.
This is the C++ code I'm working with;
Code:
extern "C" int Sort (char [] [20], int, int);
Code:
Sort (Strings, 10, 20);
cout << "Sorted Strings are" << endl;
for (i = 0; i < 10; i++)
cout << '\t' << Strings [i] << endl;
You can probably ignore my code, but I figure I would put it anyways;
Code:
Subject: Re: Accessing Array from ASM passed from C++? · Posted: 2006-12-23, 09:55pm
Rank: ? (119)
Member #: 28292
You should put the pointer passed to stack in a register. For example edx. For addressing of an element of array of chars use e.g. byte ptr [edx + ecx]. In ecx is the number of the element you want to use.