flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Windows > Why doesn't "mov eax,EBP+8" assemble?

Author
Thread Post new topic Reply to topic
Ben321



Joined: 07 Dec 2017
Posts: 22

Why doesn't "mov eax,EBP+8" assemble?

When my processess is defined as

Code:
proc MyProc FirstArg:DWORD,SecondArg:DWORD
mov eax,FirstArg
mov edx,SecondArg
endp


why do I keep getting an error when compiling? I've already included the needed .inc files to enable the "proc" and "endp" macros.


The error it gives is

Quote:
mov eax,..arg?TS



I don't even known what ..arg?TS is. I assume it is the output of one of the macros. I was expecting the first arg to be translated by the macro to EBP+8 and the second arg to be translated EBP+12. EBP+8 is valid, and would work, but ...arg?TS is not valid, so it obviously doesn't work.

When the macro is finished working the above line of code should look like:

Code:
mov eax,EBP+8
mov edx,EBP+12



These are valid. It means "Move the sum of EBP and 8 to the EAX register" and then "Move the sum of EBP and 12 to the EAX register". Why isn't the macro doing this?
Post 05 Apr 2018, 23:52
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15812
Location: Misner space

You have to include the square brackets if you want to read the value. Or alternatively, you can use LEA if you want the address of the arg (unlikely to be useful)

Code:
mov eax,[FirstArg;read the value of FirstArg
lea eax,[FirstArg;probably not useful


Ben321 wrote:
When the macro is finished working the above line of code should look like:

Code:
mov eax,EBP+8
mov edx,EBP+12



These are valid. It means "Move the sum of EBP and 8 to the EAX register" and then "Move the sum of EBP and 12 to the EAX register". Why isn't the macro doing this?

Actually, no, that is not a valid way to encode an add in Intel syntax. But LEA will do it. "lea eax,[ebp+8]"
Post 06 Apr 2018, 00:50
View user's profile Send private message Visit poster's website 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


Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2018, Tomasz Grysztar.
Powered by rwasa.