flat assembler
Message board for the users of flat assembler.

Index > Main > Converting/compiling C to FASM?

Author
Thread Post new topic Reply to topic
Victor Kindhart



Joined: 02 Feb 2015
Posts: 7
Victor Kindhart
Hey guys. I want to know is there any way to convert C code to FASM? Googling didn't really help me. It seems like it should be pretty easy - gcc can create assembly code, but not FASM syntax Sad. I've tried using
Code:
gcc -S -O3 -masm=intel ...    
but that didn't help neither.
Anyone knows how do I do this? Thanks

P. S. I am using Ubuntu, ofc
Post 02 Feb 2015, 11:42
View user's profile Send private message Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1180
Location: Unknown
HaHaAnonymous
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 18:00; edited 1 time in total
Post 02 Feb 2015, 15:39
View user's profile Send private message Reply with quote
tthsqe



Joined: 20 May 2009
Posts: 730
tthsqe
not true - you can use http://www.agner.org/optimize/#objconv
the result might need to be tweaked a little to get fasm to like it
Post 02 Feb 2015, 20:03
View user's profile Send private message Reply with quote
Victor Kindhart



Joined: 02 Feb 2015
Posts: 7
Victor Kindhart
tthsqe wrote:
not true - you can use http://www.agner.org/optimize/#objconv
the result might need to be tweaked a little to get fasm to like it


It can only produce code in yasm/nasm/masm/gasm (no fasm) but thanks for the link anyway.

But AFAIK Linux kernel IS written in C? It means it should be somehow possible to compile it to assembly...
Post 02 Feb 2015, 21:43
View user's profile Send private message Reply with quote
TmX



Joined: 02 Mar 2006
Posts: 822
Location: Jakarta, Indonesia
TmX
A quick Google search pointed me to this Perl script:
gas2fasm.txt

Take not that GCC only supports AT&T (the default one used by GAS) & MASM style assembly.

I haven't test it, though.
Post 03 Feb 2015, 02:05
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
Well, NASM syntax seems to be much closer to the FASM one, so converter should be easy to be made. But it depends on the complexity of the compiler generated source. On the other hand, the compiler will probably generate pretty simple syntax...
Post 03 Feb 2015, 09:04
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
> is there any way to convert C code to FASM?

CC386 compiler: Brews NASM syntax.
Post 09 Feb 2015, 08:50
View user's profile Send private message Reply with quote
bubach



Joined: 17 Sep 2004
Posts: 341
Location: Trollhättan, Sweden
bubach
https://github.com/bubach/Simple-C

A copy of crc's latest published source of the SmallC compiler that is modified to:

https://github.com/bubach/Simple-C/blob/master/HISTORY wrote:
August 27, 2005

FASM support should be ok, but not fully tested yet (0.1.8 )


I would be more then happy to receive pull-requests if anybody's up for continuing to work on it, or know of a more recent copy.

_________________
BOS homepage: http://bos.asmhackers.net/
Post 10 Feb 2015, 03:45
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
I have been thinking of such a project. My conversion model is very simple.

It only involves GCC and FASM. Let me know if you are interested and I will send you the model and we can start a project.
Post 10 Feb 2015, 04:25
View user's profile Send private message Reply with quote
alexfru



Joined: 23 Mar 2014
Posts: 76
alexfru
https://github.com/alexfru/SmallerC generates NASM source code. It should be possible to generate code for FASM as well. I'm pondering the idea (because FASM is smaller than NASM and I could potentially make the whole toolchain (Smaller C + assembler) fit a floppy and still have plenty of free space left and because FASM may be easier to recompile/port than NASM to some OSes).
Post 18 Jun 2015, 06:29
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 YouTube, Twitter.

Website powered by rwasa.