The MASM Forum

General => The Workshop => Topic started by: penguino on August 14, 2014, 10:51:07 AM

Title: Converting gas code to masm
Post by: penguino on August 14, 2014, 10:51:07 AM
Can anybody explain exactly what the following gas macro is doing, so I can convert it to a masm macro?

macro PUSHRSP reg
    lea -4(%ebp),%ebp
    movl \reg,(%ebp)
.emdm

Thanks.
Title: Re: Converting gas code to masm
Post by: jj2007 on August 14, 2014, 11:22:50 AM
The conversion part is easy:

PUSHRSP macro reg
  lea ebp, [ebp-4]
  mov [ebp], reg
ENDM

The question is if it does something useful ::)
Title: Re: Converting gas code to masm
Post by: penguino on August 14, 2014, 11:55:04 AM
Ahh - thanks. Now I know what it does.
Title: Re: Converting gas code to masm
Post by: Gunther on August 14, 2014, 11:56:19 AM
Jochen,

Quote from: jj2007 on August 14, 2014, 11:22:50 AM
The conversion part is easy:

PUSHRSP macro reg
  lea ebp, [ebp-4]
  mov [ebp], reg
ENDM

The question is if it does something useful ::)

that should be useful? I've my doubts. Anyway, you're now a specialist for AT&T syntax.  :t

Gunther
Title: Re: Converting gas code to masm
Post by: Vortex on August 15, 2014, 04:04:57 AM
That AT&T syntax looks always ugly. Not an easily readable notation.
Title: Re: Converting gas code to masm
Post by: habran on August 15, 2014, 05:52:30 AM
I bet jj2007 loves it :biggrin:
Title: Re: Converting gas code to masm
Post by: qWord on August 15, 2014, 06:42:52 AM
Quote from: Vortex on August 15, 2014, 04:04:57 AM
That AT&T syntax looks always ugly. Not an easily readable notation.
not surprisingly for a back-end assembler that was never intended for human usage, even if there are some geniuses who claims the opposite  8)
Title: Re: Converting gas code to masm
Post by: MichaelW on August 15, 2014, 08:01:07 PM
There is a directive you can use to switch as to the familiar Intel syntax:

.intel_syntax noprefix


In recent times even gcc supports Intel syntax, for inline assembly and the back-end assembler.
Title: Re: Converting gas code to masm
Post by: Gunther on August 15, 2014, 09:17:39 PM
Michael,

Quote from: MichaelW on August 15, 2014, 08:01:07 PM
There is a directive you can use to switch as to the familiar Intel syntax:

.intel_syntax noprefix


In recent times even gcc supports Intel syntax, for inline assembly and the back-end assembler.

and with that directive, as performs good.

Gunther