Could someone please tell me how to set a pointer to the beginning of the next line, leave it there, and come back to it latter and than set a pointer to the next line. I know what i want to do with each line but i don't know how to get back to it and go to the next line.

I think this is call string parsing or line parsing. I did a search but found nothing about this particular thing I am searching again to see if i miss anything.

Thanks in advance


EXAMPLE:

Count_Buffer db '1',0Dh,0Ah
db '2',0Dh,0Ah
db '3',0Dh,0Ah
db '4',0Dh,0Ah
db '5',0
Posted on 2002-10-29 20:28:31 by cmax
you could do it 'manually'...

define a variable in your .data section
eg ptrCB dd offset Count_Buffer

then, after you have processed one line
mov eax, ptrCB
add eax, 3 ; in your example, there's 3 bytes/line (i think)
mov ptrCB, eax ; ready for the next line

i.e. the variable ptrCB 'keeps track' of your position
in Count_Buffer
Posted on 2002-10-30 00:08:50 by argus
Or...If you got variable line lengths...how about this:




Count_Buffer db '1',0Dh,0Ah
db '2',0Dh,0Ah
db '3',0Dh,0Ah
db '4',0Dh,0Ah
db '5',0

ptrCB HANDLE 0

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

in code:

mov eax, OFFSET Count_Buffer
mov ptrCB, eax

....etc...etc

; and when getting next line:

invoke SetNextLine, ADDR ptrCB
test eax,eax
jz _FoundZeroTerminator
mov edi, eax ; pointer to next line in edi
...etc..etc...


SetNextLine PROC USES EDI pPtr:HANDLE

mov edi, pPtr
mov edi, [edi]
dec edi
@@: inc edi
cmp word ptr [edi], 0A0Dh
jz _foundCRLF
cmp byte ptr [edi], 0
jnz @B
xor eax,eax
ret
_foundCRLF: mov eax, edi
add eax, 2
mov edi, pPtr
mov [edi], eax
ret

SetNextLine ENDP



( I didn't try it though, use on own risk ) :tongue:
Posted on 2002-10-30 01:16:43 by david
Perfect-Toe

You both save me from dis-respecting the system... I founded a way but it trash a lot of memory to get the job done. Your is true ASM way. Now i am going back to put these ideas to good use.. It will work.

Thank Guys
Posted on 2002-10-30 11:39:35 by cmax