flat assembler
Message board for the users of flat assembler.
Index
> Projects and Ideas > use fasm as a generic tool Goto page 1, 2 Next |
Author |
|
Tomasz Grysztar 15 Apr 2019, 13:22
There is a reason why "virtual as" feature only allows to specify a file extension from a limited charset. With a tool like assembler nobody expects that compiling a source could spawn files in arbitrary locations or - even worse - execute any shell commands.
However, you can use fasm/fasmg to generate a command line script, for example, and then execute it in a batch build process. |
|||
15 Apr 2019, 13:22 |
|
ProMiNick 15 Apr 2019, 15:09
There is no needance in such ability in fasm syntax.
This example how hide in comment additional functionality: that can be in 2 forms in fasm comments: Code: format PE GUI 4.0 ;rename binary as 'dialog.exe' entry start ;launch CMD line '%OUTPUT%' 1 - started with phrase ";rename binary as" to rename(not move) output 2 - started with phrase "launch CMD line" - there could be any command line of cmd.exe in my example additional functionality is only batch scripts and they all runs in postassembly stage if it success. ; in example script(comment part) lines and fasm lines mixed, but they can be separated if needed for readability. Thou can make addition functionality based on any script language, and launch thour own specific script wraper over fasm or fasmg. And that will not break fasm paradigm - everyone who launch thour sources with usual fasm or fasmg will get expected actions only allowed by fasm/fasmg core. Every who will want to get additional functionality from thour sources have to launch sources via script outer to fasm|fasmg. and even so: Code: ;launch CMD line format c: in my variant it must fit one line. All in thour hands.
|
|||||||||||
15 Apr 2019, 15:09 |
|
edfed 16 Apr 2019, 07:49
Quote:
i'll give a try to this cause i don't know for sure what a programmer, like me, expects from the ultimate assembler tool. but i am ok about the shell commands, it is not really good to let the programmer execute them from the asm source cause it's platform dependent, and can lead to very specific behaviors not so portable. "FasmShell commands" with a limited set of functionnalities would be a better choice. the first problem i can see in this functionality is the circular compile that can occurs if a.asm compile b.asm that compiles a.asm, but it can be avoided by a sort of "include guard" mecanism. fasm still does a lot of thing transparently, like linking, create ERROR(folders and) files, i don't see for now the problem to let it compile a bunch of binaries during the assembly of the main program. i think it can be interresting to give a try to this idea. about the commands in comments... it can be interresting, i'll give a try to it also and compare both solutions. Last edited by edfed on 09 May 2019, 10:45; edited 2 times in total |
|||
16 Apr 2019, 07:49 |
|
Tomasz Grysztar 16 Apr 2019, 10:02
edfed wrote: fasm still does a lot of thing transparently, like linking, create folders and files, i don't see for now the problem to let it compile a bunch of binaries during the assembly of the main program. As a related example - even functions that are quite normal for an assembler to have, like fasm's FILE (which other assemblers often call INCBIN), can be quite dangerous in specific circumstances. One time someone made as fasm-backed online assembler and shared the link - I had to immediately contact them in private to let them know that by allowing to enter any source on the form on the website they made it possible to run commands like: Code: file '/etc/passwd' |
|||
16 Apr 2019, 10:02 |
|
edfed 16 Apr 2019, 13:32
Quote: No, fasm never creates any folders i talked about the folder it would create if the destination folder don't exist. and effectivelly, it don't create non existing folders... one more think i will add to my fasm version Quote: they made it possible to run commands like: i didn't think about this, that's good to know this problem. i don't want this version of fasm to be used from remote places. but now i know this "funny" problem and will not forget it if i make network fasm capability. this problem can be an interresting functionnality also if a PC runs a very simple system with only fasm on it. |
|||
16 Apr 2019, 13:32 |
|
revolution 16 Apr 2019, 14:39
Something weird happens here. Assemble this file:
Code: file '/dev/stdin' Code: flat assembler version 1.73.08 (4037072 kilobytes memory) error: out of memory. |
|||
16 Apr 2019, 14:39 |
|
Tomasz Grysztar 16 Apr 2019, 16:22
edfed wrote: i talked about the folder it would create if the destination folder don't exist. revolution wrote: Something weird happens here. Assemble this file: |
|||
16 Apr 2019, 16:22 |
|
revolution 16 Apr 2019, 16:27
This code:
Code: file '/dev/urandom' |
|||
16 Apr 2019, 16:27 |
|
Tomasz Grysztar 16 Apr 2019, 16:50
revolution wrote: This code: |
|||
16 Apr 2019, 16:50 |
|
revolution 17 Apr 2019, 00:26
I wasn't blaming you.
Thankfully this generates an error: Code: file 'rm -rf --no-preserve-root /' |
|||
17 Apr 2019, 00:26 |
|
edfed 17 Apr 2019, 08:07
revolution wrote: Something weird happens here. Assemble this file: with this line, if it worked, the ssso principle is broken due to the input of the user. hem... with anything including external files also... the main reason why i want to add build/shell commands capabilities to fasm is to add the tedious build steps in the source, with the possibility to use fasm syntax, assembly code and powerfull word processing to make projects from a single tool. for example a project as below: project/main.asm project/class1.inc project/deps/class2.inc project/test/main.asm here should go the resulting executable with everything needed to run it. project/bin/exe/main.exe project/bin/test/main.exe project/data/test1.bin;test2.bin the way to achieve that, without using any external tool than fasm would be in main.asm: Code: compile "bin/exe/main.exe" ;compile the current file somewhere testData1 equ "data/test1.bin" include "class1.inc" include "deps/class2.inc" compile "test/main.asm" "bin/test/main.exe" compile testData1 { db 0,1,2,8 } compile "data/test2.bin" { mov eax,1 } main: mov eax,0 ret compile ;compile the content at current directory { file "bin/exe/main.exe" ;it is equivalent to copy the file compiled } here the compile keyword is the functionnality i talk about. i think this functionnality is really complex to implement, but not so impossible. |
|||
17 Apr 2019, 08:07 |
|
Tomasz Grysztar 17 Apr 2019, 09:54
Well, I'm saying this with a tongue in cheek, but with fasmg you can assemble multiple projects at once and encapsulate them in a ZIP file:
Code: format binary as 'zip' macro format?.binary? as end macro macro Enscapsulate Namespace*, Source* namespace Namespace macro postpone? macro end?.postpone?! postponed esc end macro purge end?.postpone? end macro esc macro postponed end macro macro postpone? arg match ?, arg macro postpone? purge postpone? macro end?.postpone?! esc end macro purge end?.postpone? end macro esc macro __postponed __postponed end macro end match postpone end macro macro postponed end macro macro __postponed end macro include Source postponed __postponed end namespace end macro struc Assemble file Enscapsulate ., file load . : $%% from : 0 restartout 0 end struc ;------------------------------------------------------------------------------- DialogExample Assemble 'dialog.asm' Template Assemble 'template.asm' ;------------------------------------------------------------------------------- include 'zip.inc' zipfile 'readme.txt' db 'Example of multiple binaries generated in a single fasmg execution.' zipfile 'bin/dialog.exe' db DialogExample zipfile 'bin/template.exe' db Template |
|||
17 Apr 2019, 09:54 |
|
revolution 17 Apr 2019, 10:32
edfed wrote: the main reason why i want to add build/shell commands capabilities to fasm is to add the tedious build steps in the source, with the possibility to use fasm syntax, assembly code and powerfull word processing to make projects from a single tool. It is just a matter of thinking of fasm as one of the set of tools you use to manage, create, advertise and distribute your programs. |
|||
17 Apr 2019, 10:32 |
|
rugxulo 18 Apr 2019, 05:41
Sounds like you want something like WEB (literate programming) or SHAR (shell archives). Or maybe you just want some portable Make variant. (GNU Make is fairly common, even FPC includes it, even on Win32. There's also OpenWatcom's WMake and DMake and others. Those are all mostly portable, depending on what you're trying to do.)
|
|||
18 Apr 2019, 05:41 |
|
guignol 21 Apr 2019, 08:53
fasm should have had deflate support a long gime ago
and FASMD access to fasm board, too |
|||
21 Apr 2019, 08:53 |
|
guignol 24 Apr 2019, 14:59
What is wrong with having a zipped UTF-32 as a .fasm source file?
|
|||
24 Apr 2019, 14:59 |
|
edfed 27 Apr 2019, 09:05
Quote:
i think it is not the same functionnality. in my case, i can compile the .dll used by my testing .exe from the source. in your case, i just feel you want to do some absurd examples to explain me how my idea is ridiculous... no problem with that, as always, when nobody agree with me, i do alone. |
|||
27 Apr 2019, 09:05 |
|
guignol 27 Apr 2019, 17:20
look, Tomasz could develop his own LZ77-based compression method
anyway, on modern machinery still using raw text sources is ridiculous |
|||
27 Apr 2019, 17:20 |
|
edfed 27 Apr 2019, 23:09
ho, i see. yes you are true. i think sometimes about this ridiculous use of repetive text tokens to code. but it means you should continue to get a human readable source code. then, or something between binary and text, or graphix.
for my fool langage, i want to make a sort of graphic editor, letting you edit your code while running. means i would not use the source file, but directlly use the binary + a binary parser to get the edition working. maybe we should then just make a new kind of disassembler to do the job... |
|||
27 Apr 2019, 23:09 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.