flat assembler
Message board for the users of flat assembler.

Index > Main > MFASM: New Micro-FASM! Ultra Lightweight

Author
Thread Post new topic Reply to topic
m3ntal



Joined: 08 Dec 2013
Posts: 296
m3ntal 14 Jun 2014, 06:10
Micro-FASM is a minimal version of FASM.EXE (Win32 console) that consists of only the preprocessor+directives for Universal Assembler, dynamic translation and easier conversion to native ARM (example: Raspbian Linux).

FASM.EXE is only 51K (FASMW=140K). Fastest compilation: 0.1 second! Removed all instructions+registers so that any assembler/compiler can be defined. Includes \EXAMPLES\ for Intel, ARM, Java, 6502 and HTML

* FASM.ASM - Main source. Use FASMW to assemble. No setup. Includes VERSION, VARIABLE.

* \SOURCE\ - Only 5 files:

* ASSEMBLE.INC - ASSEMBLE, ERRORS, MESSAGES
* FORMATS.INC - Unedited
* PARSER.INC - PREPROCE, PARSER, EXPRPARS, EXPRCALC, SYMBDUMP
* SYSTEM.INC - Main entry, format, file I/O, display x, imports
* TABLES.INC - Removed all CPU specifics

Tomasz: Hope you like it! Smile


Description: Micro-FASM. Soon to be FASM4RPI and FASM4Droid
Download
Filename: mfasm.zip
Filesize: 146.28 KB
Downloaded: 696 Time(s)



Last edited by m3ntal on 14 Jun 2014, 23:28; edited 3 times in total
Post 14 Jun 2014, 06:10
View user's profile Send private message Reply with quote
sid123



Joined: 30 Jul 2013
Posts: 339
Location: Asia, Singapore
sid123 14 Jun 2014, 09:01
Cool!
Thanks man, I was looking for something with only the preprocessor for my Virtual machine. Nice Work. Smile

_________________
"Those who can make you believe in absurdities can make you commit atrocities" -- Voltaire https://github.com/Benderx2/R3X
XD
Post 14 Jun 2014, 09:01
View user's profile Send private message Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 517
Location: Munich
shutdownall 14 Jun 2014, 09:21
Compilation time depends on size and structure of source. Cool
Post 14 Jun 2014, 09:21
View user's profile Send private message Send e-mail Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 517
Location: Munich
shutdownall 14 Jun 2014, 09:50
sid123 wrote:
Cool!
Thanks man, I was looking for something with only the preprocessor for my Virtual machine. Nice Work. Smile


I think he removed the PREPROC.INC and also the EXPRCALC.INC / EXPRPARS.INC which will give significant restrictions during compilation.
Post 14 Jun 2014, 09:50
View user's profile Send private message Send e-mail Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 14 Jun 2014, 12:02
The idea is not bad at all, but I am not sure about the implementation. At first, if possible, the original FASM files must be used not changed in order to easy accept the future bug fixes, provided by Tomasz.
At second, the program identifies it as FASM, but it is not. The filename, strings and version numbers have to be changed in order to not confuse the user.
Post 14 Jun 2014, 12:02
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
m3ntal



Joined: 08 Dec 2013
Posts: 296
m3ntal 14 Jun 2014, 16:10
shutdownall: I mean, <0.1 second to compile FASM.ASM with FASMW on my outdated PC.
Quote:
I think he removed the PREPROC.INC and also the EXPRCALC.INC / EXPRPARS.INC which will give significant restrictions during compilation.
No, moved the files to PARSER.INC since they are related.

John:
Quote:
At first, if possible, the original FASM files must be used not changed in order to easy accept the future bug fixes, provided by Tomasz.
There are no changes to FASM language. You're just assuming there are changes when you haven't taken one look at it.
Quote:
At second, the program identifies it as FASM, but it is not.
Micro-FASM is a version of FASM that has been reorganized and has no instructions or registers. Please take one look at the source before you prejudge it.
Post 14 Jun 2014, 16:10
View user's profile Send private message Reply with quote
m3ntal



Joined: 08 Dec 2013
Posts: 296
m3ntal 14 Jun 2014, 23:30
Updated download: \EXAMPLES\ for Intel, ARM, Java, 6502 and HTML.

How to convert X86 to ARM? Examples: dec eax = subs r0, 1. rep movs byte [edi],[esi] = copy r1 # bytes to r7 from r6. If DF, negate n to decrement pointers.

Universal assembler (Pseudo):
Code:
macro inc x {
  if CPU=X86
    inc x
  else if CPU=ARM
    adds x, 1
  else if CPU=MIPS
    addi x, x, 1
  else if CPU=JAVA
    iinc x, 1
  else if CPU=M68K
    add 1, x
  else if CPU=M6502
    in#x
  end if
}    
Post 14 Jun 2014, 23:30
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 15 Jun 2014, 18:19
m3ntal wrote:
There are no changes to FASM language. You're just assuming there are changes when you haven't taken one look at it.

Without changes, means, that when Tomasz release v1.71.22, you simply have to copy/paste some files to your project, compile and get the new Micto-FASM binary. It is not the case now.
Quote:
Micro-FASM is a version of FASM that has been reorganized and has no instructions or registers. Please take one look at the source before you prejudge it.

I read the source before posting the first post. It is a fact that Micro-FASM writes:
Code:
flat assembler  version 1.71.21
usage: fasm <source> [output]
optional settings:
 -m <limit>    set the limit in kilobytes for the available memory
 -p <limit>    set the maximum allowed number of passes
 -s <file>     dump symbolic information for debugging    


How the user will understand why his source hits "error:illegal instruction" on a simple "mov"?

_________________
Tox ID: 48C0321ADDB2FE5F644BB5E3D58B0D58C35E5BCBC81D7CD333633FEDF1047914A534256478D9
Post 15 Jun 2014, 18:19
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 517
Location: Munich
shutdownall 15 Jun 2014, 21:21
m3ntal wrote:
Quote:
I think he removed the PREPROC.INC and also the EXPRCALC.INC / EXPRPARS.INC which will give significant restrictions during compilation.
No, moved the files to PARSER.INC since they are related.


I don't think it is very useful to move EXPRCALC.INC, EXPRPARS.INC and PREPROC.INC into PARSER.INC. So what is the advantage to have just one file containing at the end the contents of four files ?
And if you do so - why don't you make just one big source file ?
Post 15 Jun 2014, 21:21
View user's profile Send private message Send e-mail Reply with quote
m3ntal



Joined: 08 Dec 2013
Posts: 296
m3ntal 15 Jun 2014, 21:45
John
Quote:
It is a fact that Micro-FASM writes...
No, FASM displays that text. Micro-ASM does not change it.
Quote:
How the user will understand why his source hits "error:illegal instruction" on a simple "mov"?
By the folder name /MFASM/ or rename FASM.EXE to MFASM.EXE if it's located in the same directory with other versions of FASM (/W/ARM/X).
Quote:
Without changes, means, that when Tomasz release v1.71.22, you simply have to copy/paste some files to your project, compile and get the new Micto-FASM binary
Again, no changes to the FASM language. To update it is just a matter of copying and pasting files into the correct locations, 2 minutes.

Note: In EXAMPLES\ARM, I didn't have time to remove the @ prefix - @mov, @ldr, @15 - but I will improve the examples later. It was only there to avoid conflict with the existing assembler and is no longer needed.
Post 15 Jun 2014, 21:45
View user's profile Send private message Reply with quote
m3ntal



Joined: 08 Dec 2013
Posts: 296
m3ntal 15 Jun 2014, 22:13
shutdownall
Quote:
I don't think it is very useful to move EXPRCALC.INC, EXPRPARS.INC and PREPROC.INC into PARSER.INC. So what is the advantage to have just one file
I'd be interested in hearing what Tomasz thinks. Seems logical to have one parser module but I'm not suggesting this exact organization.

What about these files? VERSION, VARIABLE. Should they be separate or included in the main FASM.ASM for easy access? And what about ERRORS and MESSAGES? Should they be separate or in ASSEMBLE? Why not save 4 files?
Quote:
And if you do so - why don't you make just one big source file ?
I thought of this, one big FASM.INC. You can do it this way. It's like you're asking: Why reduce anything? Why not reduce everything?
Post 15 Jun 2014, 22:13
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.