I am playing around with x86 assembly for the first time and I can't figure out how to sort an array (via insertion sort).. I understand the algorithm, but assembly is confusing me as I primarily use Java & C++. Heres all I have so far
int ascending_sort( char arrayOfLetters[], int arraySize )
{
char temp;
__asm{
push eax
push ebx
push ecx
push edx
push esi
push edi
//// ???
pop edi
pop esi
pop edx
pop ecx
pop ebx
pop eax
}
}
Basically nothing :( Any ideas?? Thanks in advance.
Ok, this is just going to make me sound like a total idiot, but I can't even change any of the array's values in _asm
Just to test it out, I put:
mov temp, 'X'
mov al, temp
mov arrayOfLetters[0], temp
And this gave me an error C2415: improper operand type
so I tried:
mov temp, 'X'
mov al, temp
mov BYTE PTR arrayOfLetters[0], al
This complied, but it didn't change the array...
This code is in now way tested. I wrote it in notepad, which doesn't have a very good debugger, off the top of my head. It should be a good starting place however:
This would have been MUCH easier if you were sorting DWORD values (int) instead of BYTE values (characters).