News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

a text MACRO working in ANSI or UNICODE format

Started by TouEnMasm, October 15, 2012, 01:47:57 AM

Previous topic - Next topic

TouEnMasm


The only one difference is here,on the label
Quote
Monlabel  WORD 6 dup (?)
        dw 0
        dw 1
        dw 2

Who allow to get the size and Lengthof
Fa is a musical note to play with CL

TouEnMasm


added support for sizeof and lengthof,
Replaced the "X" by "/" ,same usage.

Quote
AU MACRO adresse:REQ,ARGS:VARARG
   local verif,count,decompte
   count = 0
   decompte = 1   ;made a loop without write nothing   
   IFDEF __UNICODE__
      :WriteWord
      verif equ <adresse>
      IFDIF verif,</>
         IF decompte EQ 0
            adresse WORD count dup (?)
            org $- count*2      ;return to adresse
            count = 0
         ENDIF
      ENDIF
            
      FOR _arg,<ARGS>
         verif SUBSTR <_arg>,1,1
         IFIDN verif,<">   
            FORC char,<_arg>   
               IFDIF <char>,<">
                  IF decompte EQ 0
                     cumul TEXTEQU <DW "&char">
                     cumul ;execute
                  ENDIF
                  count = count + 1
               ENDIF
            ENDM
         ELSE
            IF decompte EQ 0         
               DW _arg
            ENDIF
            count = count + 1                     
         ENDIF
      ENDM
      IF decompte EQ 1
          decompte = 0
          GOTO WriteWord
      ENDIF
      EXITM<>

   ELSE
      :WriteByte
      verif equ <adresse>
      IFDIF verif,</>
         IF decompte EQ 0
            adresse BYTE count dup (?)
            org $- count      ;return to adresse
            count = 0
         ENDIF
      ENDIF
            
      FOR _arg,<ARGS>
         verif SUBSTR <_arg>,1,1
         IFIDN verif,<">   
            FORC char,<_arg>   
               IFDIF <char>,<">
                  IF decompte EQ 0
                     cumul TEXTEQU <DB "&char">
                     cumul ;execute
                  ENDIF
                  count = count + 1
               ENDIF
            ENDM
         ELSE
            IF decompte EQ 0         
               DB _arg
            ENDIF
            count = count + 1                     
         ENDIF
      ENDM
      IF decompte EQ 1
          decompte = 0
          GOTO WriteByte
      ENDIF
      EXITM<>      
   ENDIF            
ENDM
NAU MACRO namelabel:REQ,ARGS:VARARG
   .data
   AU (namelabel,ARGS)
   .code
   EXITM <namelabel>
ENDM   


Fa is a musical note to play with CL

jj2007

Quote from: ToutEnMasm on October 18, 2012, 06:45:36 AM
   adresse WORD count dup (?)
   org $- count*2      ;return to adresse

Nice trick, Yves :t