This program is Freeware.
You may copy and use the program, if you don't get money for this.
If you change this program, your version must be also Freeware and 
you should send me a message.

!masm-expd expands macros for non-macro-assemblers.
Assembler-macros are very useful, to make a assembler-program more readable
and easier to maintain.

e.g. if you often use some equal commands: 
(target-assembler: Basic-inline-assembler):

(1)
     SWI "OS_WriteS"
     .adress_1 EQUS " String 1 "
     EQUB 0
     ALIGN
     B hupf_1
     .adressptr_1 EQUD adress1
     .hupf1 LDR R1,adressptr_1     

     SWI "OS_WriteS"
     .adress_2 EQUS " String 2 "
     EQUB 0
     ALIGN
     B hupf_2
     .adressptr_2 EQUD adress2
     .hupf2 LDR R2,adressptr_2     

     SWI "OS_WriteS"
     .adress_3 EQUS " String 3 "
     EQUB 0
     ALIGN
     B hupf_3
     .adressptr_3 EQUD adress3
     .hupf3 LDR R3,adressptr_3     


it's useful to put them in a macro and use the macro

(2)
     printstr MACRO register,outputstring
     LOCAL adress,adressptr,hupf
     SWI "OS_WriteS"
     .adress EQUS outputstring
     EQUB 0
     ALIGN
     B hupf
     .adressptr EQUD adress
     .hupf LDR register,adressptr     
     ENDM

     printstr R1," String 1 "
     printstr R2," String 2 "
     printstr R3," String 3 "

this program is made to expand (2) into (1). 


Commands:


MACRO   :  defines a Macro-header.

  macroname MACRO arg1,arg2, .... argN

LOCAL   :  define local labels (labels which are only valid inside this macro) 
 
  LOCAL label1,label2, ... labelN

ENDM    :  define the end of a macro

  ENDM

use the macro with 

  macroname argument1,argument2, .... argumentN

INCLUDE :  the programm can also read from multiple files with 

  INCLUDE filename

this is useful, if you have a collection of useful macros


in addition to this, !masm-expd writes a outputfile suitable for the
basic-inline-assembler.

to allow conditional assembling there are 3 Commands more (note: only for
the basic-inline-assembler !!!)

IF, ELSE and ENDIF

IF (boolean basic-expression)
   assemble this, if expression is true
ELSE    
   assemble this, if expression is false
ENDIF


Syntax:


 syntax: 
 !masm-expd [-basic [-start adress]] outputfile inputfile 
 options:
 -basic        (optional) build a file for bas-inline-assembler und run it
 -start adress (optional, only valid with -basic) start-adress of outputfile 
 defaults:
 no -basic option
 if -basic set: adress = &8000


Problems: 


 problems to make mathematics in the IF-  boolean basic-expression with 
 identifiers, which not known yet  

 if you use the basic-option and your binary will become greater than the 
 value in the line 
 asmlength="XXXXX" ;
 of <masm-expd$dir>.MASMsyntax then you must patch it 

 maybe you want to include other functions in the basic-file 
 (e.g. FPAssemble of Stewart Brodie seems to be interesting) use instead of 
 if the last linenumber of <basic-text-file> is greater then the first 
 linenumber in <masm-expd$dir>.work.basicfile, then patch 
 linenumber= XXXXX ; in <masm-expd$dir>.MASMsyntax to the matching value 
 but in most cases, it's better to use the basic-commands CHAIN or LIBRARY
 patch
 REM LIBRARY
 to 
 CHAIN or LIBRARY
 of <masm-expd$dir>.MASMsyntax

!masm-expd is a typical gawk-script, short and a little bit slow.
On the Acorn Archimedes multitasking with gawk is impossible and gawk must be 
started on the commandline (if don't have a program like !prog).

Errormessages and other opions are wellcome.  

So long

MUFTI 
( 
  zrzm0111@helpdesk.rus.uni-stuttgart.de   in the internet
 and
  ZRZM at DS0RUS1I                         in the bitnet
) 
 
