Are there rules for file order in assembler input stream?

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am writing in AVR assembler and have one file containing a bunch of useful macros.

 

Recently one macro I wrote contains a call to an assembler routine in a separate file

that I  .included at some place . That file in turn uses two other macros contained in the macros-file.

 

This seems to confuse the assembler. I could get it to work only by .including the files in a certain order.

 

I had to .include the assembler file at the end of the file containing the macros.

 

If the assembler is truly multi-pass, I would have thought that order of file input to the assembler

would make no difference.

 

I have noticed on other occasions that the assembler is fussy about order, and particularly at what point I 

.include the file of macros.

 

I am using AS6.1

 

Can anybody shed any light on this?

Last Edited: Fri. Feb 17, 2017 - 09:13 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Paul as I said in another thread you are heading for a ban here, this is your last warning.

 

Post you replies for threads no more than a week old if you have something USEFUL to say.

 

Post new messages in the correct forums, you have posted twice mega subjects in the XMEGA forum, replied to post up to 16 years old and now you are posting in the wrong forum again.

This forum is for Studio bugs ONLY, I will move the thread to the general programming forum for now.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

PaulWDent wrote:

If the assembler is truly multi-pass, I would have thought that order of file input to the assembler

would make no difference.

 

Well yes, but most MCU assemblers are not actually  truly multi-pass.

Many expect to resolve everything in 2 passes, or maybe 3.

 

So you do have to help them a little, with some care in ordering.

 

 

Even those more serious assemblers, that can do a great many passes, can still have issues that need operator help.

You could look at something like Fasmg, if you are hitting 'standard assembler' limits.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And of course the Atmel assembler is NOT multi pass but single pass.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And macros are fancy text substitution, so they get done on EACH pass.  Multi-pass assemblers get pretty confused if a macro does different things on different passes...

(and macros as well as symbols can get redefined, so of course they are order-dependent.)