Pelles C forum

Assembly language => Assembly discussions => Topic started by: HellOfMice on December 06, 2024, 06:37:05 AM

Title: Replace PUSH / POP
Post by: HellOfMice on December 06, 2024, 06:37:05 AM
Sometimes or allways using PUSH makes crashing the functions
So I replace the PUSH by setting the register into a local variable
or I use the xmm registers like this:

@WmGetMinMaxInfos :

                            mov     [r9].MINMAXINFO.ptMinTrackSize.x,256    ; Take care that the window is too minimized
                            mov     [r9].MINMAXINFO.ptMinTrackSize.y,256
                            mov     [r9].MINMAXINFO.ptMaxPosition.x,0
                            mov     [r9].MINMAXINFO.ptMaxPosition.y,0

                            movd    xmm9,r9
                            mov     ecx,SM_CXFULLSCREEN
                            call    GetSystemMetrics
                            movd    r9,xmm9

                            mov     [r9].MINMAXINFO.ptMaxTrackSize.x,eax
                            mov     [r9].MINMAXINFO.ptMaxSize.x,eax

                            movd    xmm9,r9
                            mov     ecx,SM_CYFULLSCREEN
                            call    GetSystemMetrics
                            movd    r9,xmm9

                            mov     [r9].MINMAXINFO.ptMaxSize.y,eax
                            mov     [r9].MINMAXINFO.ptMaxTrackSize.y,eax

                            jmp     @Eoj
Title: Re: Replace PUSH / POP
Post by: Vortex on December 06, 2024, 09:07:13 AM
Hello,

QuoteSometimes or allways using PUSH makes crashing the functions

In the world of 32-bit coding, consecutive PUSHs for local storage are welcomed but 64-bit coding is restrictive as the stack alignment is sensitive.
Title: Re: Replace PUSH / POP
Post by: HellOfMice on December 06, 2024, 09:25:07 AM
Hello Vortex,

You are right.

I suggest to create many discussions/sub-forums about asm64
I have some sources from AMD, and other found every where plus mines.
From Agner Fog and Yours too .

That would make the forum living, maybe Pelle is dead but not his forum

What do you think?

Philippe
Title: Re: Replace PUSH / POP
Post by: Vortex on December 07, 2024, 09:31:43 AM
Hello Philippe,

Let's wait for the announcement of the forum administration. Maybe, Mr. Pelle will return to the forum.

I think both of us and other coders could continue to contribute this section of the forum. New members interested in assembly language can visit the Assembly discussions subforum.