flat assembler
Message board for the users of flat assembler.

Index > Main > FASM as compiler backend through pipe, patch for

Author
Thread Post new topic Reply to topic
Minas



Joined: 02 Apr 2010
Posts: 4
Minas 02 Apr 2010, 10:13
Hello, I have written such mail to Tomas, regarding to subject, But haven't received any answer. Later I read somewhere from 3rd persons, that Tomas is not accepting patches, I don't know is it really so.
Anyway, now I doubling that mail here, with patches, may be it would be interesting to somebody, and he/she will finish the work.

I'm thinking it is shame for such a powerful asm not to able to handle source code fed into stdin.

Regards.

===
Hello,

I am trying to use fasm as backend for my tiny home-brew compiler (hoping it become big, stable and useful one)
and collide with problem that it is impossible to give assembler source code to the fasm through stdin, using pipe.
Compiler now is pretty fast, so I wanted to attach a fast assembler to it.

Well, I've tried to solve the problem, modifing fasm source. And even did, but somehow undecidable for me now problemsa was arised.

*What I did:
Modified source code of fasm to add '--' switch, which will mean "take asm source file from stdin"
added for that special boolean flag.

*What I get:
Without includes,
and without using macros
- it works.
But it is necessary it work normally. I don't know why it didn't include now files

*What is a problem now:
I don't know where to look, and what to correct to make "include" working,
so through that - get working macros, for generating dlls (or exes)
Particularly, my test file, x2dll.asm in fasm\Source\Win32\ can not be built into x2.dll

Will you assist in solving this problem?
Honestly, I would like eventually, to see this patch incorporated in fasm.

Sources I'm now attaching: fasm-.tar.gz, and separately, the full directory of modified fasm (renamed .exe files to .ex# for gmail antivirus).
And all I did was for Win32 platform, now yet, although others are important too, but well, now win32 was first
Modified fasm version I called "fasm-exe" to distinguish with original version
and so do other files, thay all have '-' suffix', by name of '--' switch.

Original fasm version was 1.68
Changed files are:
Source\variable-.inc'
Source\preproce-.inc'
Source\Win32\FASM-.ASM (replaces FASM.ASM for fasm-.exe)

I hope it is interesting to you add new features to fasm.

Thanks,
Minas Abrahamyan


Description: full modified sources
Download
Filename: fasm-_full.tbz2
Filesize: 402.84 KB
Downloaded: 250 Time(s)

Description: source patches only file
Download
Filename: fasm-.tar.gz
Filesize: 19.81 KB
Downloaded: 258 Time(s)

Post 02 Apr 2010, 10:13
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20300
Location: In your JS exploiting you and your system
revolution 02 Apr 2010, 19:59
I don't understand why you need to use pipes. Can you please explain why saving the source to a disk file first isn't good for you?
Post 02 Apr 2010, 19:59
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 03 Apr 2010, 12:53
revolution wrote:
I don't understand why you need to use pipes. Can you please explain why saving the source to a disk file first isn't good for you?
Why save the source if it's generated and you won't need it after the output is assembled? No reason to stress your poor harddrive unnecessarily Smile

_________________
Image - carpe noctem
Post 03 Apr 2010, 12:53
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20300
Location: In your JS exploiting you and your system
revolution 04 Apr 2010, 12:18
Well so far no response from the OP. Maybe you are right, those pesky .asm files are taking up too much space on my HDD. Perhaps I should delete them and just leave the binaries. That way if I ever need to change anything I can always disassemble/edit/recompile (all with using pipes of course).
Post 04 Apr 2010, 12:18
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 04 Apr 2010, 13:15
Quote:
I'm thinking it is shame for such a powerful asm not to able to handle source code fed into stdin.

me too, I think sometimes, yeah, it happens, i think, i have a brain. Very Happy

it is a shame that so much HLL are develloped to let poor coders make money with poor programs.

asm powaaa, on all CPU/GPU/DSP.
then, no bad code made by laxist coders, only code made by people who are able to code with Assembly.

and the coputing world will feel better.

that's all.
Post 04 Apr 2010, 13:15
View user's profile Send private message Visit poster's website Reply with quote
Frank



Joined: 17 Jun 2003
Posts: 100
Frank 04 Apr 2010, 14:56
Hello Minas, welcome to the message board. And thank you for sharing your work! I did not have the time for a closer look yet, but from your description, it seems that it can be very useful to many.
Post 04 Apr 2010, 14:56
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 04 Apr 2010, 15:08
revolution wrote:
Well so far no response from the OP. Maybe you are right, those pesky .asm files are taking up too much space on my HDD. Perhaps I should delete them and just leave the binaries. That way if I ever need to change anything I can always disassemble/edit/recompile (all with using pipes of course).
It's not really about space, it just feels wasteful to write something to disk that isn't going to be used again - and your disassembly/edit/recompile doesn't hold since this would be used to pipe output from the assembly generator backend from some_other_language Smile

_________________
Image - carpe noctem
Post 04 Apr 2010, 15:08
View user's profile Send private message Visit poster's website Reply with quote
Minas



Joined: 02 Apr 2010
Posts: 4
Minas 04 Apr 2010, 17:49
Frank wrote:
Hello Minas, welcome to the message board. And thank you for sharing your work! I did not have the time for a closer look yet, but from your description, it seems that it can be very useful to many.

Thank you for kind words Smile

Well, this could be of use for everyone, who are using other assemblers through pipe (nasm, gas, yasm)
and wants to give fasm a try.

revolution wrote:
I don't understand why you need to use pipes. Can you please explain why saving the source to a disk file first isn't good for you?

That's not matter of disk space, but simplicity, performance, modularity.

f0dder wrote:
revolution wrote:
Well so far no response from the OP. Maybe you are right, those pesky .asm files are taking up too much space on my HDD. Perhaps I should delete them and just leave the binaries. That way if I ever need to change anything I can always disassemble/edit/recompile (all with using pipes of course).

It's not really about space, it just feels wasteful to write something to disk that isn't going to be used again - and your disassembly/edit/recompile doesn't hold since this would be used to pipe output from the assembly generator backend from some_other_language Smile


Yes, you're right. Compiler I am building pretend to have fast compilation speed, and will run compiled code immediately, without producing asm code, although asm output will remain as debugging option, but, anyway linking (in sense of data flow channel) these programs, frontend and backend, through pipe is most sensible option. Also programming in Unix way.

When researching previous similar work I saw as HLA author tried to convert fasm to library callable by C (cFASM), but he replaces asm with his own non-compatible low-level compiler, and thus breaks asm-compatibility. Also it is not much supportable, as I could guess. Well, such project as fasm, isn't too, as it was criticized by same Randall Hyde.

Best feature of fasm, from my point of view, is its macros system, which allows to build output files and binaries without use of linker. I would call this performance, if I wouldn't know that there is multi-pass interpreter inside of fasm, written in assembler, and as such and as present implementation is not much maintainable.

But, since I didn't find any other supportable assembler with dll/exe output and x86_64 instructions support, I've took the fasm and sawed it Smile

Initially I didn't know that Tomasz is not accepting patches, and read about it recently. My original mail was sent to him roughly a month ago.

Regards.
Post 04 Apr 2010, 17:49
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 05 Apr 2010, 08:35
you can maybe see the version or famos. the "memory" operating system.

it will use source from a memory place, without any file saving.
it is like a pipe, you will just have to write a pipe for the ram zone used as source code. and another pipe from the ram zone used as binary code.

and it will compile to another ram zone.

its name is fasmf, written by Neville Watkin.

Code:
;-- -------------------------------------------------------------------------
;  W A T K I N    T E C H N O L O G Y    S o f t w a r e  D i v i s i o n
;---------------------------------------------------------------------------
; PROGRAM: Flat Assembler port to FAMOS - Preliminary DOS tests
; VERSION: 1.0                            PLATFORM: IBM PC
; PROJECT: FAMOS Memory Operating System      FILE: FASMF   .ASM
;  AUTHOR: Neville Watkin                     DATE: 11 Sep 2008
;---------------------------------------------------------------------------
;                            Revision History
;
;11.09.08  Preliminary DOS tests
;---------------------------------------------------------------------------
; based on:
; flat assembler interface for DOS
; Copyright (c) 1999-2003, Tomasz Grysztar.
; All rights reserved.

;init_flatrm deleted
;reads source code from fixed address 0:800000H
;writes pre-processed source to 0:400000H, writes code to 0:600000H
;(intended to produce flat binary code only)   
    


i think it can be a good start for you pipe project. Very Happy
Post 05 Apr 2010, 08:35
View user's profile Send private message Visit poster's website Reply with quote
kalambong



Joined: 08 Nov 2008
Posts: 165
kalambong 08 Apr 2010, 05:03
Wow, didn't know about the existence of such a thing !!
Post 08 Apr 2010, 05:03
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.