News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

rep movsb error in Win 7?

Started by HSE, July 25, 2016, 09:52:53 AM

Previous topic - Next topic

HSE

Hi!

Why I obtain an error at program closing using this macro? There is no error if I allow winXP compatibility in exe properties.

CopiaObjeto macro tipo_de_objeto, ObjectDest, ObjectOrig

DbgText "CopiaObjeto macro"
;int 3
push esi
push edi
push ecx
pushfd

mov edi, &ObjectDest;[Dest]
    cld
    mov esi, &ObjectOrig
    mov ecx , sizeof TPL_&tipo_de_objeto;[ln]
    rep movsb

    popfd
    pop ecx
pop edi
pop esi
endm


Thanks in advance.
Equations in Assembly: SmplMath

hutch--

That code should work anywhere. What are the instructions "pushfd" "popfd" being used for when the data copy has nothing to do with processor flags ?

HSE

Thanks Hutch!
I put all the push and pop just in case ("cld" change direction flag). Only "esi" need to be preserved.   
The extrange thing is that Xp compatibilty remove the issue, it's almost the same code you showed for 64bits.
Equations in Assembly: SmplMath

jj2007

What is "an error"? What do you see happen in the debugger after the int 3?

HSE

If rep it's not the problem then... I'm overwriting something necesary to dipose the objects!  :icon_redface:  And trying to destroy 2 times the same object result in a random jump (theory here).

I'm sure in ObjAsm there is an especific function, but it's a little hard to find  :icon_eek:.

Hutch: Perhaps you can move the topic to ObjAsm, because (I think now) the issue is related to that (another option it's subforum "Beer abstinence consequences")  :biggrin: .

Thanks very much. 

Working: CopiaObjeto macro tipo_de_objeto, ObjectDest, ObjectOrig

push esi

    cld
mov edi, &ObjectDest;[Dest]
    add edi , 16
    mov esi, &ObjectOrig
    add esi, 16
    mov ecx , sizeof TPL_&tipo_de_objeto;[ln]
    sub ecx , 16
    rep movsb

pop esi
endm

Equations in Assembly: SmplMath