In message <12200703900878@sbbs.se>, =?iso-8859-1?q?Ruben_J=F6nsson?= writes >Hello Tom > >The string concatenation is not supported in MPASM. > >Too bad because it could be used to reduce a lot of >typing at the start of a project. > >For every bit in a port or a register that hold bit information I >declare 2 symbols and 1 definition with similar names: > >b_red_led equ 0 ;Bit 0 >m_red_led equ 1<#define f_red_led port_a,b_redled ;Flag definition used for bsf/bcf > >which could be replaced with a macro, something like: > >bitdefs 0,port_a,red_led > >which would reduce the source quite alot. > >Someday I might just do my own preprocessor for this.. > > >> From: Tom Dee >> Subject: MPASM macro question > >> My apologies if this question shows up twice. My previous message >> appears to have been lost. >> >> I need to concatenate a string to an expanded macro parameter. For >> example: >> >> myMacro MACRO arg >> CONSTANT arg#?(Bar) = 99 ;#?() is some concatenation operator >> ENDM >> >> myMacro foo ; this should define the constant "fooBar" >> >> Does this capability exist in MPASM?? >> >> Thanks, Tom.... >> Rather than write a pre-processor, why not use the M4 macro-processor? It is *very* powerful, and will do virtually anything you want. Here is a very simple example that does string concatenation: File test.m4 ------------ define(`myMacro',`$1bar = 99') File test.txt ------------- myMacro(foo) DOS command: m4 test.m4 test.txt produces the output: foobar = 99 In practise, the output would be written to a file using I/O re- direction, or piped to an assembler or compiler. Most of the features of a conventional programming language are provided, including conditionals, loops and string manipulation. GNU M4 (m4.exe) for DOS on 386/486 systems can be found in the Simtel archive, amongst the DJGPP stuff (DOS port of gcc). Leon -- Leon Heller: leon@lfheller.demon.co.uk http://www.lfheller.demon.co.uk Amateur Radio Callsign G1HSM Tel: +44 (0) 118 947 1424 See http://www.lfheller.demon.co.uk/rcm.htm for details of a low-cost reconfigurable computing module using the XC6216 FPGA