Parsing the string one way works - how do I copy a subset into a buffer for display? Please see the ????>>>>> below.






.data
fmtTxt db 40 DUP(?)
alf db 40 DUP(?)
alf2 db "%s",0

.code

xor edi,edi
rloop:
lea edi, alf ;no not some fuzzy alien

inc edx ;increment edx which is pointing to input string
inc ecx ;ecx keeps track of # of records.
cmp dl,0Ah ;found a LF? exit
je nloop ;if EOL then exit and print substring

mov al,[edx]

mov [edi], al
inc edi
cmp al," " ;found a space?
jne rloop ;not yet? jump back to rloop

nloop:
????????? >>>>>>> mov alf, edi ;how do I get alf into edi so I can display it..
;I probably need to zero-terminate the string also

pushad

invoke wsprintf, ADDR fmtTxt, ADDR alf2, alf
popad
pushad
invoke MessageBox, NULL, ADDR alf, ADDR fleERR, MB_OK
popad
Posted on 2004-01-14 12:48:49 by drarem
One byte at a time.

You need to have two addresses and a counter.

You can either code a loop, or use REP MOVSB.

To use REP MOVSB, load ESI with the start address of the string you want to copy, EDI with the start address of where you want to put it, and ECX with the number of bytes you want to copy.
   mov esi,[pInputBuffer]

mov edi,[pOutputBuffer]
mov ecx,[NumberOfBytes]
rep movsb
You can also copy as you are parsing, but that involves combining two tasks in one loop.
Posted on 2004-01-14 20:24:50 by tenkey
thanks, I am using this now, which works:

mov BYTE PTR ,al

I did have to do a

mov edx, STRING
mov edi, OFFSET alf ;<<< one part of problem solved
mov al,
cmp al," "
jne ...

until I get up to speed, my functions will be messy and convoluted dernit.
Posted on 2004-01-16 10:40:24 by drarem