News:

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

Main Menu

TYPE and real

Started by TouEnMasm, November 02, 2020, 01:52:07 AM

Previous topic - Next topic

TouEnMasm

Hello,
This macro load a real on a REAL4 or REAL8 in data
usage:   .data chose REAL8 0 .code MOVR chose,8.0
It's work but ... I want to extend it.
The "if TYPE(etiquette) EQ arg " works only if the argument arg is inside the loop for.
I try to create my own value of comparison but no one work
For example: create value with the "for arga,<REAL8>" loop and try to use it in
the comparison "if TYPE(etiquette) EQ value" don't work.
Any help ?


MOVR MACRO etiquette:REQ,reel:REQ
   Local texttype,value
   texttype equ <>
   for arga,<REAL8>
      value equ <arga>
   endm
   AFFICHE value
   for arg,<REAL4,REAL8>      
      ;value equ (TYPE(REAL8))
      ;AFFICHE  <TYPE(etiquette)>
      if TYPE(etiquette) EQ arg ;REAL8
         texttype equ <arg>
         if arg EQ  REAL8
            movsd xmm0,REEL8(reel)
            movd etiquette,xmm0               
         endif   
         if arg EQ REAL4
            movss xmm0,REEL4(reel)
            movss etiquette,xmm0                        
         endif      
         EXITM
      endif
   endm
   IFB texttype
      .ERR <etiquette NOT a REEL>
   endif
ENDM

Fa is a musical note to play with CL

TouEnMasm


This one to be more clear
Quote
MOVR MACRO etiquette:REQ,reel:REQ
   Local texttype,zreel4,zreel8
   texttype equ <>
   for arg,<REAL8>
      zreel8 equ arg
   endm   
   for arg,<REAL4>
      zreel4 equ arg
   endm   
                  
   ;value equ (TYPE(REAL8))
   if zreel8 EQ TYPE(etiquette) ;REAL8
      texttype equ <arg>
      movsd xmm0,REEL8(reel)
      movd etiquette,xmm0   
   elseif  zreel4 EQ TYPE(etiquette) ;REAL8
      texttype equ <arg>         
      movss xmm0,REEL4(reel)
      movss etiquette,xmm0   
   endif
   ;-----------------------------------------------      
   
   IFB texttype
      .ERR <etiquette NOT a REEL>
   endif
ENDM
Is there a way to replace
   for arg,<REAL8>
      zreel8 equ arg
   endm   

Fa is a musical note to play with CL

HSE

Quote from: TouEnMasm on November 02, 2020, 07:49:40 PM
This one to be more clear
No  :biggrin:

You only have to make:zreel8 textequ <REAL8>
Equations in Assembly: SmplMath

TouEnMasm

Fa is a musical note to play with CL