Author Topic: Poasm Version 8.00.0  (Read 4154 times)

Vortex

  • Moderator
  • Member
  • *****
  • Posts: 1691
Poasm Version 8.00.0
« on: April 10, 2014, 04:38:23 AM »
Poasm Version 8.00.0 can be obtained with the latest Pelles C development toolset.

Pelle's announcement :

Quote
    Added 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

  • Member
  • *****
  • Posts: 3515
  • Forgive your enemies, but never forget their names
Re: Poasm Version 8.00.0
« Reply #1 on: April 10, 2014, 08:10:28 AM »
Good news, Erol.  :t

Gunther
Get your facts first, and then you can distort them.

Vortex

  • Moderator
  • Member
  • *****
  • Posts: 1691
Re: Poasm Version 8.00.0
« Reply #2 on: April 17, 2014, 03:44:41 AM »
Prologue \ epilogue macros turned off :

Code: [Select]
.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

  • Member
  • *****
  • Posts: 3515
  • Forgive your enemies, but never forget their names
Re: Poasm Version 8.00.0
« Reply #3 on: April 17, 2014, 07:57:43 PM »
Hi Erol,

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
Get your facts first, and then you can distort them.

jj2007

  • Member
  • *****
  • Posts: 7444
  • Assembler is fun ;-)
    • MasmBasic
Re: Poasm Version 8.00.0
« Reply #4 on: April 18, 2014, 12:14:56 AM »
Actually, it's a bit worse: ret doesn't insert any code. So you definitely need to insert retn X yourself.

Vortex

  • Moderator
  • Member
  • *****
  • Posts: 1691
Re: Poasm Version 8.00.0
« Reply #5 on: April 18, 2014, 03:58:45 AM »
Jochen is right. Here is Pelle's explanation :

Quote
It'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

  • Member
  • *****
  • Posts: 3515
  • Forgive your enemies, but never forget their names
Re: Poasm Version 8.00.0
« Reply #6 on: April 18, 2014, 10:48:43 PM »
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
Get your facts first, and then you can distort them.

Vortex

  • Moderator
  • Member
  • *****
  • Posts: 1691
Re: Poasm Version 8.00.0
« Reply #7 on: March 01, 2015, 08:33:08 PM »
Poasm Version 8.00.1 coming with Pelles C version 8.00 Release Candidate 7 :

Pelle's announcement :

Quote
Added POASM type SQWORD (and sqword)