A92: Fargo Preprocessor


[Prev][Next][Index][Thread]

A92: Fargo Preprocessor




I'm going to make a Fargo preprocessor, in the next weeks. I just wanted
to
ask you for suggestions/comments about it. The idea is the following:
All assembly sourcetexts, that need to be preprocessed are named .XAS .
So adding a line to the begin of fargo.bat like >>prefargo %1.xas
%1.asm<<
will preprocess the program befor compilation. (At the end you could add

del %1.asm) The preprocessor will do the following:

  * remove tabulators and spaces after commas, so you can write
     >>move.w    d0,    d1<< instead of >>move.w d0,d1<<
  * C - like comments (/*...*/ and //...)
  * C - like macros, with some changes, this will give you the
possibility to
    write some of these things:

   #define loop(block) {
     local lable    // makes looplable local within the macro
     label:
            block
            bra label
    }

  #define ifeq(block) {
    local label
              bne    label    // if equal flag is not set don't do the
block
              block
    label:
  }

   _main:
     lea  LCD_MEM, a0
    move.w d7, -(a7)
    clr.w d7
     loop ({
       clr.l (a0)+
       addq.w #1, d7
       cmp.w d7, #959
       ifeq ({move.w (a7)+,d7 ; bra end})
     })
    end:
    rts

 of course this is just a silly example, but it shows you, what will be
possible.
 You could also write for - loop - macros, or anything else. {...} is to
pass
 arguments, that can contain commas or linebreaks. ; is to force a
linebreak, when
 preprocessing. (to write many commands on one line)


Follow-Ups: