Current program takes in command line args and prints them to screen, compiled with gcc. The stack contains addresses that point to the arguments taken in. I need to convert the two arguments, add them and print the result.
I've tried adding the value by dereferencing the registers like this:
movl (%edi), %edi
addl %edi, (%esi)
I've also tried subtracting "0" to convert the string
sub "0", (%esi)
My partial code is:
printLoop:
movl 12(%ebp), %esi # Get **argv pointer to the vector table
movl (%esi,%ebx,4), %esi # Use the pointer to indirectly load the address of the
# next command line argument. %ebx is the index
incl %ebx
movl 12(%ebp), %edi
movl (%edi, %ebx, 4), %edi #pointer to next arg in edi?
#sub "0", (%esi)
movl (%edi), %edi # don't work
addl %edi, (%esi) # don't work
call printString # print the null terminated command line argument
movl $newLine, %esi # go to the next line
call printString # prints the arg
I've also tried saving the value of the second arg in %edx
and then adding, it doesn't work.