News:

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

Main Menu

Poasm Version 8.00.0

Started by Vortex, April 10, 2014, 04:38:23 AM

Previous topic - Next topic

Vortex

Poasm Version 8.00.0 can be obtained with the latest Pelles C development toolset.

Pelle's announcement :

QuoteAdded new option /Fl to produce a list file. See the help file for more information.
    Added operators SECTIONREL and IMAGEREL.
    Added instructions for BMI1, BMI2, LZCNT, TZCNT, RTM, and AVX2.
    Added prefix XACQUIRE and XRELEASE.
    Added type OWORD and YWORD as (maybe better) aliases for XMMWORD and YMMWORD, respectively.
    Added support for user-defined prologue and epilogue macros.

http://www.smorgasbordet.com/pellesc/download.htm

Gunther

Good news, Erol.  :t

Gunther
You have to know the facts before you can distort them.

Vortex

Prologue \ epilogue macros turned off :

.386
.model flat,stdcall
option casemap:none

MessageBoxA PROTO :DWORD,:DWORD,:DWORD,:DWORD
MessageBox  EQU <MessageBoxA>
ExitProcess PROTO :DWORD

testproc    PROTO :DWORD,:DWORD

MB_OK       EQU 0

.data

capt        db 'Hello',0
message     db 'This is a test',0

.code

start:

    invoke  testproc,ADDR message,ADDR capt

    invoke  ExitProcess,0

OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE

testproc PROC _msg:DWORD,_title:DWORD

    invoke  MessageBox,0,DWORD PTR [esp+12],\
            DWORD PTR [esp+12],MB_OK

    retn    2*4

testproc ENDP

OPTION PROLOGUE:PrologueDef
OPTION EPILOGUE:EpilogueDef

END start


You need to specify the retn instruction instead of ret to balance manually the stack.

Gunther

Hi Erol,

Quote from: Vortex on April 17, 2014, 03:44:41 AM
You need to specify the retn instruction instead of ret to balance manually the stack.

it's a bit like the Pascal convention. The callee has to clean up the stack.

Gunther
You have to know the facts before you can distort them.

jj2007

Actually, it's a bit worse: ret doesn't insert any code. So you definitely need to insert retn X yourself.

Vortex

Jochen is right. Here is Pelle's explanation :

QuoteIt's a "known feature" - use retn or retf instead of ret in this case (no epilogue). I use ret as a kind of pseudo instruction: it triggers the emission of epilogue code plus a ret instruction when needed, so when "no epilogue" is set you get no ret instruction either. I looked at improving this, but it was just too much work (at least for this version).

Gunther

Quote from Intel Manual Vol. 2B page 4-369: RET—Return from Procedure
Quote
Transfers program control to a return address located on the top of the stack. The address is usually placed on the stack by a CALL instruction, and the return is made to the instruction that follows the CALL instruction.

The optional source operand specifies the number of stack bytes to be released after the return address is popped; the default is none. This operand can be used to release parameters from the stack that were passed to the called procedure and are no longer needed.
This kind of RET  N is valid in 64 bit mode and Compatibility/Legacy Mode.

Gunther
You have to know the facts before you can distort them.

Vortex

Poasm Version 8.00.1 coming with Pelles C version 8.00 Release Candidate 7 :

Pelle's announcement :

QuoteAdded POASM type SQWORD (and sqword)