Before I programmed in ASM, I programmed in pascal. I'm trying to make macros that resemble some of the pascal stuff, just for fun. I made this macro to resemble the pascal var parameter:

VAR macro variables:VARARG
  LOCAL varName, numVar, varSize, variable, _data

  FOR variable, 
    varSize TEXTEQU 

    ;; check for arrays
    if @InStr(1,,<[>)
      varName SUBSTR , 1, @InStr(1,variable,<[>)-1
      numVar SUBSTR , @InStr(1,variable,<[>)+1, \
        @InStr(@InStr(1,,<[>),variable,<]>)-@InStr(1,variable,<[>)-1
    else
      if @InStr(1,,<:>)
        varName SUBSTR ,1,@InStr(1,variable,<:>)-1
      elseif @InStr(1,,<=>)
        varName SUBSTR ,1,@InStr(1,variable,<=>)-1
      else
        varName TEXTEQU 
      endif
      numVar TEXTEQU <1>
    endif
    
    ;; check for size
    if @InStr(1,,<:>)
      if @InStr(1,,<=>)
          varSize SUBSTR , @InStr(1,variable,<:>)+1, \
        @InStr(@InStr(1,,<:>),variable,<=>)-@InStr(1,variable,<:>)-1
        else
      	  varSize SUBSTR , @InStr(1,variable,<:>)+1
      endif
    endif
    
    ;;check for data
    if @InStr(1,,<=>)
      .data
      _data SUBSTR , @InStr(1,variable,<=>)+1
      varName varSize numVar dup(_data)
    else
      .data?
      varName varSize numVar dup (?)
    endif
  ENDM
  .code
ENDM
This code lets me do stuff like VAR buffer[256]:CHAR and VAR a,b,c,d and VAR message:CHAR="hello world" but I want to do VAR message:CHAR=<"hello world",13,10,0> to include 13,10 and 0 at the end of the string unfortunately the "," makes the compiler think its the end of the variable and goes to the next one. does anyone know how I can get this to work?
Posted on 2001-06-02 18:33:00 by Satrukaan
"VAR message:CHAR=<"hello world",13,10,0>" If in the MACRO you use VARARG as the last parameter you should be able to append what you like as string data. I doubt that you can use the angle brackets <> as it has a specific meaning in MASM but you should be able to do the rest I think. Regards, hutch@pbq.com.au
Posted on 2001-06-02 21:12:00 by hutch--
Unfortunately I used vararg to declare multiple variables: for example: VAR message:CHAR="Hello World", buffer[256]:CHAR I could do something like: VAR message:CHAR="Hello World",CR:CHAR=13,LR:CHAR=10,NULLCHAR:CHAR=0 but not only do I have to declare an extra variable, but I can no longer can use "sizeof message" to get the proper length of the message I would have to use "sizeof message+3"
Posted on 2001-06-03 14:04:00 by Satrukaan