Find the answer to your Linux question:
Results 1 to 2 of 2

Thread: Linux Assembly

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Linux Assembly

    I'm hoping to get some help with my assembly.

    I am very new to it, though am familiar with spaghetti coding due to previous self-training in BASIC.

    I have been using NASM and completed a simple hello-world program, and am moving on to a (hopefully) simple addition program taking command line parameters.

    I am trying to read from the stack without pop-ing into the e*x registers, which I was told I could do using esp with an offset.

    Answers I have come across on google are written for different assemblers and a bit confusing to me.

    Right now, my goal is to use two separate write() syscalls to write the first two command line parameters back to the standard output, but I'm not sure of the offset.

    Here is the (I believe) relevant code:

            ;Clear out the first 2 CL arguments from the stack
    	pop	eax
    	pop	eax
            mov	eax,4
    	mov	ebx,1
    	mov	ecx,esp
    	mov	edx, ? << This is where I get confused.
    	int	80h

  2. #2
    Well I found out that since I was accepting user input of indeterminate length that I would have to manually search the memory for the terminating character (NULL) byte. I wrote a subroutine called strLen that does that and got my program working wonderfully!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts