Olin Lathrop wrote: > > Do you know such macroassembler that is able to recognize labels, > > jump and call instructions to be able to keep a valid value in a > > variable you suggested? Optimalisation is the most difficult job > > when you try to write any compilator. To build a tree of a program > > isn't trivial. > > MPASM certainly can't do that. The scheme I talked about is not > fully automatic. I have the UNBANK macro which invalidates all bank > assumptions. It is usually used at labels where execution can come > from more than one point. At other places like subroutine entries > and call points I already use macros that automatically do an UNBANK. > > > I would have been satisfied by a macroassembler that is able to do > > nontrivial string operations with parameters sending to macro. Do > > you know any? > > Microsoft MASM is the best assembler I've ever used, and it can do > what you ask but is only for the Intel x86 processors. Unfortunately > MPASM is pretty stupid in its handling of macro arguments. Assembly language is pretty simple to preprocess with Perl (or any other scripting language, for that matter), and this allows you to add fairly arbitrary macro-like capabilities. For example, I wrote a preprocessor that implements flow control commands (if/else/endif, loops, etc.) for the ADSP-21xx series of DSPs. This pretty much eliminates having to manually create labels within subroutines, avoiding the hassle of making up non-conflicting names. When I started working with PICs, I extended it to support them as well. After fiddling around with Olin's DBANKIF/UNBANK macros, I wrote a second preprocessor that inserts them automatically -- you just need to "declare" the symbols that are in banked RAM and it finds them wherever they're subsequently used. Together, these make the source code much more readable and easier to work with. Of course, this makes the toolchain rather complicated, involving my two preprocessors, Olin's "prepic" processor, Olin's macros and then the Microchip assembler and linker. I use Makefiles and the command- line tools, so I really don't need to worry about it once it's set up the first time. -- Dave Tweed -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu