I want to implement bubblesort and quicksort in x86_64 assembly language on Linux, but I'm having a lot of trouble. I can't get a basic swap routine (swapij) to work.
Any help would be greatly appreciated. Thank you.
The program is built with:
yasm -f elf64 -g dwarf2 -o testStr.obj testStr.asm
gcc -g -z noexecstack testStr.obj -o testStr
You don't have the necessary buffers
These
dbs just side aside a single byte each (preloaded with the value 64). What you need is something like:Doesn't your
strcpyneed to be told how many bytes to copy?You provide destination and source addresses, but I don't see you pass an actual length to
strcpy.Also, pay extra attention to the comments that you write. Upon returning from getElement, it is RSI that points to the string in the i-th 64-byte record of the array. And a mention like "contains str" is definitely confusing/wrong since the register does not contain any characters from the string. Instead the register contains a pointer to a certain string.