flat assembler
Message board for the users of flat assembler.

Index > Main > Problem assembling with fasm under radasm

Author
Thread Post new topic Reply to topic
Tony



Joined: 14 Dec 2006
Posts: 2
Tony
I hope I'm posting this to the correct group.

I've just begun learning x86 assembly language and I have setup RadASM to use fasm.

In RadASM I have created a new Win32 app project called Test using the Win32 dialog app Project wizard. So all the code at this point is generated by the wizard.

When I try to assemble it I get the following error:

FASM "Test.asm" "Test.exe"
flat assembler version 1.67.15 (1196914 kilobytes memory)
Test.asm [21]:
enter
error: invalid operand.

Fasm doesn't seem to recognise the "enter" instruction ?

Any help would be much appreciated by this assembly language newbie.

Thanks,

Tony
Post 14 Dec 2006, 13:14
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
"Win32 dialog app Project wizard" is clearly pretty outdated. Who is it's maintainer?
Post 14 Dec 2006, 13:39
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Garthower



Joined: 21 Apr 2006
Posts: 158
Location: Ukraine
Garthower
RadAsm breaks the specification, or it's made for any optimization of input of a source code. Here that is written about this command in documentation by AMD:

Quote:

ENTER
Creates a stack frame for a procedure.
The first operand specifies the size of the stack frame allocated by the instruction.
The second operand specifies the nesting level (0 to 31—the value is automatically
masked to 5 bits). For nesting levels of 1 or greater, the processor copies earlier stack
frame pointers before adjusting the stack pointer. This action provides a called
procedure with access points to other nested stack frames.
The 32-bit enter N, 0 (a nesting level of 0) instruction is equivalent to the following
32-bit instruction sequence:

push ebp ; save current EBP
mov ebp, esp ; set stack frame pointer value
sub esp, N ; allocate space for local variables

The ENTER and LEAVE instructions provide support for block structured languages.
The LEAVE instruction releases the stack frame on returning from a procedure.
In 64-bit mode, the operand size of ENTER defaults to 64 bits, and there is no prefix
available for encoding a 32-bit operand size.
Action

// See “Pseudocode Definitions” on page 49.
ENTER_START:
temp_ALLOC_SPACE = word-sized immediate specified in the instruction
(first operand), zero-extended to 64 bits
temp_LEVEL = byte-sized immediate specified in the instruction
(second operand), zero-extended to 64 bits
temp_LEVEL = temp_LEVEL AND 0x1f
// only keep 5 bits of level count
PUSH.v old_RBP
ENTER Create Procedure Stack Frame

Mnemonic Opcode Description
ENTER imm16, 0 C8 iw 00 Create a procedure stack frame.
ENTER imm16, 1 C8 iw 01 Create a nested stack frame for a procedure.
ENTER imm16, imm8 C8 iw ib Create a nested stack frame for a procedure.
Post 14 Dec 2006, 14:05
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
i think that "enter" was overdefined by FASM macro in old times. But now it is not used anymore
Post 14 Dec 2006, 17:28
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
RedGhost



Joined: 18 May 2005
Posts: 443
Location: BC, Canada
RedGhost
The syntax for enter is:
Code:
ENTER imm,imm                 ; C8 iw ib  
    


The first immediate is the number of bytes to allocate on the stack and the second is the nesting level. I suppose you could use "enter 0, 0". Just modify the macro it is using.

edit: seems Garthower already posted this.

_________________
redghost.ca
Post 14 Dec 2006, 23:22
View user's profile Send private message AIM Address MSN Messenger Reply with quote
Tony



Joined: 14 Dec 2006
Posts: 2
Tony
Thanks to everyone for their help with this.

Tony
Post 15 Dec 2006, 09:00
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.