News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

jump over 2 zeros in al

Started by ragdog, January 31, 2008, 09:03:55 PM

Previous topic - Next topic

ragdog

hi  ::)

i have problem with read my hex string.
   
It print not the 2 string! I have yet 2x Inc
esi write to jump  over the 2 zero´s  or not?

example to print: msgbox Test1
                         msgbox Test2
                         msgbox Test3


.data
sztest       db054h,065h,073h,074h,031h,000h,000h,054h,065h,073h,074h,032h,000h,000h,054h,065h,073h,074h,033h,00h,00h
;Test100Test200Test300


.code

readstrings proc

LOCAL szDest1[256]:BYTE
LOCAL szDest2[256]:BYTE
LOCAL szDest3[256]:BYTE
LOCAL szDest4[256]:BYTE
LOCAL szDest5[256]:BYTE

            xor esi,esi
            xor edi,edi
        mov esi,offset sztest       
@Read_Test1:
        mov al, byte ptr [esi]      
            mov byte ptr szDest1[edi], al
            inc edi                      ;inc dest buffer
            inc esi                      ;inc src buffer
            cmp al,00h                   ;compare if al 00h
            jnz @Read_Test1              ;jmp if al not 00h
         invoke MessageBox,hWnd,addr szDest1,0,MB_OK
           
            inc esi
            inc esi
@Read_Test2:
        mov al, byte ptr [esi]      
            mov byte ptr szDest2[edi], al
            inc edi                      ;inc dest buffer
            inc esi                      ;inc src buffer
            cmp al,00h                   ;compare if al 00h
            jnz @Read_Test2              ;jmp if al not 00h
         invoke MessageBox,hWnd,addr szDest2,0,MB_OK
...
..
.

readstrings endp


thanks in forward
ragdog

RuiLoureiro

Quote from: ragdog on January 31, 2008, 09:03:55 PM

@Read_Test1:
           mov al, byte ptr [esi]        
            mov byte ptr szDest1[edi], al
            inc edi                      ;inc dest buffer
            inc esi                        ; points to the next 0
            cmp al,00h                   ;compare if al 00h
            jnz @Read_Test1              ;jmp if al not 00h
         invoke MessageBox,hWnd,addr szDest1,0,MB_OK
           
            inc esi
            ; inc esi

Hi,
         I think you have 2 inc esi   instead of    inc esi.  Is it ?
Rui

ragdog

i removed a one "inc esi"
No, unfortunately, is the same problem!

Thank you

RuiLoureiro

       lea     edi, szDest1 
and  lea    edi, szDest2   to get the address of szDest1 ... ? Doesnt work ?

ragdog

It is any other problem, the first string is displayed to the msgbox  not the string 2 ...

:'(

MichaelW

The main problem is that you are not setting edi back to zero before the second loop. Also, you need only one inc esi because the first loop is leaving esi set to the second null.
eschew obfuscation

ragdog



i have it inc esi
           xor edi,edi

thanks michael

ragdog