News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

cunning macro

Started by korte, November 20, 2007, 03:47:41 AM

Previous topic - Next topic

korte

I would like to prepare a macro like that what stores the granted parameter text and address.

sample:


  sample_macro  label22


want output:

dd offset label22
db "label22"


would be dreamlike if, I would be able to store his type.
The problem that I did a DINT, DFLOAT types I proposed what are normal double words as myself simply, that you are whole floating point.


DINT textequ <dd>
DFLOAT textequ <dd>

label22  DINT ?
label23 DFLOAT ?


Back can be won, how he was defined how?
sample
if type DINT store 1 else if type DFLOAT store 2

hutch--

korte,

You need to use assembler data types.

For the C form of INT you can use either DWORD or SDWORD.

For floating point maths data types use any of REAL4, REAL8 or REAL10.

To wrie to EITHER type you need to write a custom UNION that can handle different data types in the same member location.

I am not on my dev box at the moment but its something like,


MyType UNION
  inttype dd ?
  fptype REAL10
ENDS
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

korte


I was not understandable according to me. (apology not strong it English)

I would like two things.

1.

Establishing that all is the parameter in a macro is you float type.

label1 dd 0
label2 real4 0

xxx macro p1
if p1 dd
if p1 real4



2. To store the parameter of a macro szringként* and title

label1 dd 0

xxx macro p1

xxx label1

want output
db "label1"
dd offset label1

and if possible: type flag
dd type (if dd then store 0  or real8 store 1)



korte

#3
work.

thx



AddWatch      macro      p1,p2,p3
      local      __watch
      dd      offset p1  ; variable
      ifb <p2>
            if type(p1) EQ byte
                  dd      w_char
            elseif type(p1) EQ DWORD
                  dd      w_dword
            elseif type(p1) EQ REAL4
                  dd      w_float
            else
                  dd      w_dump
            endif
      else
            dd      p2 ; type
      endif
__watch:
      ifnb <p3>
            db      p3      ; text
      else
            db      "&p1&"
      endif
      db       32-($-__watch) dup (0)

      endm


      AddWatch   axis_x._command