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 > Main > pre-release: fasm 1.52

Goto page Previous  1, 2, 3  Next
Author
Thread Post new topic Reply to topic
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6395
Location: Kraków, Poland

Code:
macro put address,[instruction]
 {
   common local base,size,char
   virtual address
    base = $
    instruction
    size = $-base
   end virtual
   repeat size
    virtual address
     instruction
     load char from base+%-1
    end virtual
    store char at base+%-1
   end repeat
 }

put at 0x400,\
mov eax,0

Post 25 Mar 2004, 12:06
View user's profile Send private message Visit poster's website Reply with quote
LiuJunfeng



Joined: 28 Nov 2003
Posts: 48
Location: China
I see, the "load char from base+%-1" and "store char at base+%-1" are symmetric in form. It is nice for translation of data.
Post 26 Mar 2004, 13:46
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6395
Location: Kraków, Poland
Now command line versions accept the memory limit setting switch among the parameters, which allows you to specify limit in kilobytes for the amount of memory fasm will use (the same setting that was already available for a long time in the Win32 GUI version). For example to force fasm to use no more than 1 MB of memory, execute it like this:

Code:
fasm -m1024 some.asm some.out


(you can put the switch anywhere in the command line, the space between the switch and a number is also allowed).
In case of DOS version, this limit may not be obeyed very strictly, as it limits only allocation of extended memory, so if fasm decides to use some conventional memory also, the total amount of memory used may be slightly larger.
Post 27 Mar 2004, 19:50
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7113
Location: Slovakia
great, at least some command line paramters.

what about -p to create result of preprocessing only?
like
fasm -p:some.pre some.asm some.out
or maybe
fasm --preprocess some.asm some.pre
Post 27 Mar 2004, 21:52
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1104
Location: Russian Federation
is it possible for store directive to work on later generated labels?

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 27 Mar 2004, 22:54
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6395
Location: Kraków, Poland
It can store any value (that is it can be any numerical expression), but only into the previously generated code (the same as "load" directive can load bytes only from the code that has already been generated).
Post 27 Mar 2004, 23:13
View user's profile Send private message Visit poster's website Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1104
Location: Russian Federation
also, store does not seem to work in PE executable when destination value is in, say, data section, and you attempt to use store directive in code section.

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 27 Mar 2004, 23:20
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6395
Location: Kraków, Poland
Yes, this is also for the same reason, as with the "load" directive, only the current addressing space (current section) is available, and I'm afraid it's hard to do anything more about it (as there is no way to determine offset in output for the address outside of current addressing space).
Post 27 Mar 2004, 23:23
View user's profile Send private message Visit poster's website Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1104
Location: Russian Federation
thanks
it is helpful as it is now even

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 27 Mar 2004, 23:26
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6395
Location: Kraków, Poland
I have tested the fasm-generated MS COFF object files with more than 65535 relocations per section with the LINK and GoLink. Both accepted such object file, but only LINK generated the correct executable, GoLink used only first 65535 relocations, ignoring the rest.
Post 28 Mar 2004, 11:04
View user's profile Send private message Visit poster's website Reply with quote
Vortex



Joined: 17 Jun 2003
Posts: 334
Privalov,

Have you tried also Pelle's MS link compatible linker Polink?

_________________
Code it... That's all...
Post 28 Mar 2004, 14:39
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6395
Location: Kraków, Poland
No, can you try it for me?

BTW (and now for something completely different), please note that now fasm supports the regular INCLUDE variable, which can be shared with other compilers (any number of paths separated with semicolons is allowed). So you can add your fasm's include directory to the list in the INCLUDE variable, and - for instance - use:

Code:
include 'win32a.inc'
include 'macro/if.inc'


instead of:

Code:
include '%fasminc%/win32a.inc'
include '%fasminc%/macro/if.inc'


(but note that you need to keep FASMINC variable to keep some of those includes working properly).
Post 28 Mar 2004, 21:25
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6395
Location: Kraków, Poland
The floating point numbers starting with dot are now finally disallowed completely (thanks to vid's suggestion), to avoid confusion with the local labels and errors due to processing them inside structure macros. Now only symbols starting with a decimal digit are considered a numbers.

Also, as a part of syntax cleaning I'm considering removing the "load from file" syntax (to make it with "store" a clean pair of dual directives), because you can still do the same task with code like:

Code:
virtual at 0
 file 'file.txt':2,4
 load a dword from 0
end virtual


But I understand that actually removing some feature would be treated as a strange idea, so if there's much of protestation, I will abandon this concept.


Last edited by Tomasz Grysztar on 28 Mar 2004, 23:19; edited 1 time in total
Post 28 Mar 2004, 21:54
View user's profile Send private message Visit poster's website Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1104
Location: Russian Federation
If you can encapsulate it in a macro with parameters exactly as the obsolete "load from file" directive, then I do not see much trouble

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 28 Mar 2004, 22:38
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6395
Location: Kraków, Poland
The simplest variant:

Code:
macro loadconst const,place
 { if place eqtype 0
    load const From place
   else
    virtual at 0
     file place
     load const From 0
    end virtual
   end if }

macro load [arg]
 { from fix ,
   loadconst arg
   from fix From }

From fix from



Last edited by Tomasz Grysztar on 29 Mar 2004, 20:25; edited 1 time in total
Post 28 Mar 2004, 23:05
View user's profile Send private message Visit poster's website Reply with quote
hGoblin



Joined: 03 Apr 2004
Posts: 3
I've just tried to compile all my fasm projects with fasm 1.52.
With old includes the result is the same as with old fasm (and the same bugs), with new includes it says 'Unexpected end of file'. I cant realize why. I have no time to search forum for known bugs, so sorry, if i repeat after somebody. The procs with alone parameter, e.g.

Code:

proc Fx:DWORD
enter
mov eax,[x]
return



are compiled to code, similar this:

Code:

...
mov eax, [ebp+(!!!)C(!!!)]
...



, when x is ebp+8. procs, having more than one parameter, compiles to right code. It's a problem of both fasm 1.51 and 1.52a2 (with old includes). Maybe this bug is in a macros?
Post 03 Apr 2004, 04:36
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1046
Location: Michigan, USA
How about an enum directive?
It would work the same as c/c++:

enum var1=5,var2,var3,var4
equals: var1=5 var2=6 var3=7 var4=8

another way:
enum var1=5,var2,var3=10,var4
equals: var1=5 var2=6 var3=10 var4=11

or with step value:
enum 5,var1=15,var2,var3,var4
equals: var1=15 var2=20 var3=25 var4=30
Post 03 Apr 2004, 07:29
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2149
Location: Estonia
The last one seems nice addition, but to my mind it is the ground for macros. This is a gadget, not a feature!
Post 03 Apr 2004, 09:57
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6395
Location: Kraków, Poland
x:DWORD? Are you sure it's fasm syntax?
Also don't forget the "endp" at the end of proc when you're using new macros.

madmatt: look here: http://board.flatassembler.net/topic.php?t=826
Post 03 Apr 2004, 11:12
View user's profile Send private message Visit poster's website Reply with quote
hGoblin



Joined: 03 Apr 2004
Posts: 3
Privalov
x:DWORD? Are you sure it's fasm syntax?
But fasm have no claims to this code. At least before 1.52.
On the contrary, some procs couldn't be compiled w/o dword. However, deleting dwords helps. I guessed, bug is in my brain....
adding endp helps to get rid of 'Unexpected end..', but caused no less obsure errors. I'll wait for official release.
Post 03 Apr 2004, 12:56
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3  Next

< 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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.