flat assembler
Message board for the users of flat assembler.
Index
> Main > Just Preprocessor? FASM with No Assembler? |
Author |
|
shutdownall 02 Sep 2013, 16:33
No assembler doesn't make sense.
Please take notice, that at least data definitions like db, dw, dd and so on are assembly directives. Of course you can disable the X86_64.INC if not used or simply empty this file when deleting the instructions section in TABLES.INC. And I think you don't need AVX.INC any more (after stripping TABLES.INC). I think such a version isn't existing but you can do yourself in a few minutes. Could be more done to strip it down but this is maybe too much work and you have to go deeper into the code. And I guess you know, that a complete ARM version of FASM is already existing ? See section Non-X86-architectures in the forum. |
|||
02 Sep 2013, 16:33 |
|
edfed 02 Sep 2013, 16:43
no assembler in fasm means just f
why not, it is an iterresting idea to just have the fasm macro system with a bunch of cpu definitions. we still have arm, pic12bits and x86, and just one compiler, and the list can grow as fast as we want, (if we want) personnaly, i find it very interesting, and if we can generate the cpu specific opcodes with a set of universal mnemonics, we can then have the universasm, and then, write in assembly one time, compile and run everywhere (better than java i mean). with f as a launcher, we can easy have a sort of virtual virtual machine (means real machine). just we have to compile and run, and as fasm is fast, we just have to run.... keep it up, a f version of fasm can really be interesting. maybe TG can think about it. |
|||
02 Sep 2013, 16:43 |
|
cod3b453 02 Sep 2013, 17:10
I seem to have a version of this called "fasmpre" that I had used for this but this looks to now be called "prepsrc" under the tools directory (there's also a listing and symbols dumper).
EDIT: OK not quite this only does preprocessing, sorry |
|||
02 Sep 2013, 17:10 |
|
shutdownall 02 Sep 2013, 19:45
edfed wrote: personnaly, i find it very interesting, and if we can generate the cpu specific opcodes with a set of universal mnemonics, we can then have the universasm, and then, write in assembly one time, compile and run everywhere (better than java i mean). If you like to rename mnemonics, you can do easily yourself while editing the TABLES.INC and compile FASM. Since now there are only 2 official FASM versions existing - for x86 processors and for the ARM family. But I am not sure if this is not just a private project maintained by revolution. I myself made a version for Zilog Z80 CPUs and Tomek made a Q&D JAVA version based on macros. So I wouldn't count this as a separate FASM version. The problem is that all targets are quite different and use different instructions. What does it help to change the mnemonics to universal mnemonics when you have to think in different architectures ? There are maybe some helpful synonyms when you are confused. I myself am sometime confused by using jr (jump relative for Z80) with jmp (jump for x86). But if this justifys a separate version maintained by TG - I don't think so. But you can do yourself easily, upload the version to Non-x86-architectures and maintain it in future when new releases are posted. Everyone could do. And why make a new version stripped with functions not needed ? Just because it results a little bit smaller exe file ? Who cares ... There is a reason why FASM is delivered as source code. Everyone can make his own version easily. With keyboard shortcuts for menmonics or whatever you wish. I think if you ask 100 members you get at least 110 versions. And as stated in my first posting here: There was alreay a FASMARM version existing. I don't know why there is now a macro framework done creating ARM output which could be created with FASMARM ? |
|||
02 Sep 2013, 19:45 |
|
bitRAKE 03 Sep 2013, 00:43
The differences in processor state from instruction to instruction would be very difficult to model. So, an intermediate language would be the least common denominator approach -- loosing all the benefits of programming in assembler. Cross-assembling would have the same limited benefit, depending on architecture commonalities.
From a design perspective it would be interesting to turn FASM inside-out: having a machine independent core consisting of just a pre-processor. All instructions and output formats would be defined in a machine independent way. This would be similar to writing FASM in a HLL, though. |
|||
03 Sep 2013, 00:43 |
|
uart777 03 Sep 2013, 02:05
Ok, I'll have to edit FASM.
cod3b453: That's what I'm thinking of but with the assembly-time directives (if/while/etc). Such a project would be valuable for educational purposes: Learning how to create dis/assemblers, compilers, emulators. shutdownall: It makes perfect sense. FASMX86+FASMARM have 3,000+ definitions and reserved names/aliases that I'll never use. Quote: And I guess you know, that a complete ARM version of FASM is already existing ? See section Non-X86-architectures in the forum. Quote: Tomek made a Q&D JAVA version based on macros |
|||
03 Sep 2013, 02:05 |
|
uart777 03 Sep 2013, 05:38
shutdownall:
Quote: And as stated in my first posting here: There was alreay a FASMARM version existing. I don't know why there is now a macro framework done creating ARM output which could be created with FASMARM ? As for FASMARM, I've probably released more code for it than anyone else in this community. After I finish this project, I'll still recommend FASMX86+FASMARM. Mini-ARM Macro Assembler will be provided for programmers who are experienced with FASM's preprocessor and who want to learn ARM machine code and see different techniques for converting instructions. Example/Excerpt: An easier way to create shx instructions: @lsr r0, 7 = @mov r0, r0, lsr 7. (enumerate creates 0-3 = SH.lsl, SH.lsr, SH.asr, SH.ror): Code: enumerate SH, lsl, lsr, asr, ror irps x, lsl lsr asr ror { macro @#x a, b \{ verify.r a if b ?is.r dd 0E1A00000h or (a shl 12) or \ (b shl 8) or (SH.\#x shl 5) or \ 10000b or a else if b ?is.i verify.sh x, b dd 0E1A00000h or (a shl 12) or \ (b shl 7) or (SH.\#x shl 5) or a else 'Source must be R/I: ' b end if \} } Code: macro verify.shx s { if ~ s in <lsl,lsr,asr,ror> 'Invalid shift:' s end if } macro verify.sh s, n { verify.shx s if n<0 | n>31 'Number exceeds range (0-31): ' n end if } Code: ?is.r fix in <r0,r1,r2,r3,r4,r5,r6,r7,\ @8,@9,@10,@11,@12,@13,@14,@15> ?is.i fix eqtype 0 ?is.m fix eqtype [0] macro verify.r r { if ~ r ?is.r 'Register expected: ' r end if } macro verify.i i { if ~ i ?is.i 'Number expected: ' i end if } Thanks for viewing! Last edited by uart777 on 03 Sep 2013, 07:34; edited 1 time in total |
|||
03 Sep 2013, 05:38 |
|
uart777 03 Sep 2013, 06:45
Macros to verify the range of numbers. Helpful when making assemblers/compilers:
Code: macro verify.n n, min, max { if n<min | n>max 'Number outside range: ' n end if } macro verify.4 n { verify.n n, -15, 15 } macro verify.u4 n { verify.n n, 0, 15 } macro verify.8 n { verify.n n, -255, 255 } macro verify.u8 n { verify.n n, 0, 255 } macro verify.i8 n { verify.n n, -128, 127 } macro verify.12 n { verify.n n, -4095, 4095 } macro verify.u12 n { verify.n n, 0, 4095 } macro verify.i12 n { verify.n n, -2048, 2047 } macro verify.16 n { verify.n n, -65535, 65535 } macro verify.u16 n { verify.n n, 0, 65535 } macro verify.i16 n { verify.n n, -32768, 32767 } |
|||
03 Sep 2013, 06:45 |
|
uart777 03 Sep 2013, 09:17
bitRAKE:
Quote: So, an intermediate language would be the least common denominator approach -- loosing all the benefits of programming in assembler. Cross-assembling would have the same limited benefit, depending on architecture commonalities. Code: @add r5, r7 ; a+b @add r5, 0FFh ; a+i @add r5, r6, r7 ; a=b+c @add r5, r6, 7 ; a=b+i @add r5, r6, lsl r7 ; a=b<<c @add r5, r6, lsl 7 ; a=b<<i @add r0, r3, r5, lsr r7 ; a=b+(c>>>d) @adds r0, r3, r5, lsr 7 ; a=b+(c>>>i) @add:ne r0, r1, asr r7 ; ne? a=(b>>c) @adds:lt r0, r1, asr 7 ; lt? a=(b>>i) @add:gt r0, r3, r5, ror r7 ; gt? a=b+(c<>>d) @adds:mi r0, r3, r5, ror 7 ; mi? a=b+(c<>>7) ARM has many advantages over Intel: Powerful arithmetic, conditional execution, instant barrel shift/rotate in same CPU cycle, 3+ operands, fixed instruction width for special optimizations, execute Java bytecode and more. |
|||
03 Sep 2013, 09:17 |
|
l_inc 05 Sep 2013, 09:33
uart777
Quote: That's what I'm thinking of but with the assembly-time directives (if/while/etc). Technically not possible, because assembly-time directives are processed within the same stage as producing opcodes from instructions. Both are therefore mutually dependent on each other's output. The best one could do is full compilation with subsequent disassembly into fasm syntax, possibly using debug symbols to restore label names and to correctly separate data and code definitions. _________________ Faith is a superposition of knowledge and fallacy |
|||
05 Sep 2013, 09:33 |
|
dogman 09 Sep 2013, 13:39
Maybe not what you were looking for but http://www.99-bottles-of-beer.net/language-ibm-hlasm-macro-2228.html is an example of using IBM's macro assembler language without any assembly code generation to print out the 99 bottles of beer song (no I did not write this).
I think you may able to do something similar with PL/I's macro processor. It is very powerful but it's been mumble mumble years since I used it so I can't remember. And I can't remember if it works standalone but I think it does. _________________ Sources? Ahahaha! We don't need no stinkin' sources! |
|||
09 Sep 2013, 13:39 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.