flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Non-x86 architectures > [AVR] fasmg assembles with error(s)

Author
Thread Post new topic Reply to topic
tomi



Joined: 08 Nov 2017
Posts: 3
[AVR] fasmg assembles with error(s)
I tried to assemble a lil project that correctly assembles with avrasm2.exe but fasmg throws error(s). Is there a better add-on for fasmg available?
Post 08 Nov 2017, 15:15
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15237
Location: 1I/ʻOumuamua
Can you show the source code, or the line(s) that give(s) an error?
Post 08 Nov 2017, 16:00
View user's profile Send private message Visit poster's website Reply with quote
tomi



Joined: 08 Nov 2017
Posts: 3
This is the output:

Quote:

flat assembler version g.hykpg
sensor.asm [35]:
.include 'sensor.inc'
Processed: .include 'sensor.inc'
Error: illegal instruction.


Original line is: .include "sensor.inc"
Post 08 Nov 2017, 16:41
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15237
Location: 1I/ʻOumuamua
".include" is not fasm syntax. fasm uses "include" without the dot (.) character. fasmg follows this convention also. You can change the source code and remove the leading dot.

Note that all assemblers are different. In general you usually can't assemble unchanged source code from one assembler on another assembler, unless you take specific steps to support it and the assemblers are very similar.
Post 08 Nov 2017, 16:53
View user's profile Send private message Visit poster's website Reply with quote
tomi



Joined: 08 Nov 2017
Posts: 3
Thanks for explanation. I'll see if I can make fasmg to accept .include as well, because changing my sources is not an option, I code in asm almost every day and there is tons of code there.
Post 08 Nov 2017, 17:02
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6633
Location: Kraków, Poland
At the end of AVR.INC that comes as an example with fasmg you may find a macro that already adds support for some directives starting with dot:

Code:
macro ? line&
        match =BREAK?line
                _BREAK
        else match .=ORG? addrline
                if ~ DSEG?
                        org (addrshl 1
                else
                        org addr
                end if
        else match .=EQU? name == valueline
                name? = value
        else match .=DSEG?line
                if ~ DSEG?
                        virtual at DSEG?.$
                        DSEG? = 1
                end if
        else match .=CSEG?line
                if DSEG?
                        DSEG?.$ = $
                        end virtual
                        DSEG? = 0
                end if
        else
                line
        end match
end macro

You could add support for ".include" by adding another clause like:

Code:
        else match .=INCLUDE? fileline
                include file

But still, the AVR example included in fasmg package is only a very simple one and it does not attempt to fully emulate syntax of any other AVR assembler. Someone probably could make a better set of macros for this purpose, but I don't know if anyone tried.
Post 08 Nov 2017, 20:26
View user's profile Send private message Visit poster's website 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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.