CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2011
    Posts
    2

    Question position in buffer

    Hello!
    Is there anyone here that knows how to step in a buffer?
    Since I have problem with putting the whole code in this editor I try to explain my problem without the whole code.

    Lets say that I have a buffer declared as:

    Code:

    INBUFFER: .skip 128

    And I have allready placed following in the buffer: 314+555

    In order to read this I step through the buffer in the positions 0 to 6. So, in my subroutines I first read 314, put it in a new buffer, OUTBUFFER, and then I put the +sign and thereafter the program shall start to read the number 5 at position 4. But this doesn't work out for me.
    Here's how I try to do it.
    Code:

    getinpos:
    movl START_INPOS, %ecx
    movl %ecx, %ebx

    getchar:
    movl $INBUFFERT, %ebx

    START_INPOS has 4, which is correct, but someone told me that I'm overwriting ebx here. And I can understand that, but how should I do this. Now when starting to read, the subroutine starts to read at position 0 again , i e 3 and then 1 and so on.....

    Can anyone help me here?

    Anders

  2. #2
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: position in buffer

    Quote Originally Posted by and11 View Post
    [...] but someone told me that I'm overwriting ebx here. And I can understand that, but how should I do this.
    Of course you do. That should be obvious to anyone who has a basic understanding of (x86) assembly language.

    Not only that this task looks rather trivial and like a homework assignment (see http://www.codeguru.com/forum/showthread.php?t=366302), the information you provide is insufficient for anyone who actually would want to do that assignment for you (regardless of the fact that this is strongly discouraged on the forum here).
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  3. #3
    Join Date
    Oct 2011
    Posts
    2

    Re: position in buffer

    OK, sorry about that.

    Anders

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured