Click to See Complete Forum and Search --> : position in buffer


and11
October 31st, 2011, 02:32 PM
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

Eri523
October 31st, 2011, 10:50 PM
[...] 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).

and11
November 1st, 2011, 03:02 AM
OK, sorry about that.

Anders