Author Topic: TYPE and real  (Read 558 times)

TouEnMasm

  • Member
  • *****
  • Posts: 1615
    • EditMasm
TYPE and real
« on: November 02, 2020, 01:52:07 AM »
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

  • Member
  • *****
  • Posts: 1615
    • EditMasm
Re: TYPE and real
« Reply #1 on: November 02, 2020, 07:49:40 PM »

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

  • Member
  • *****
  • Posts: 1618
  • <AMD>< 7-32>
Re: TYPE and real
« Reply #2 on: November 02, 2020, 10:55:03 PM »
This one to be more clear
No  :biggrin:

You only have to make:
Code: [Select]
zreel8 textequ <REAL8>

TouEnMasm

  • Member
  • *****
  • Posts: 1615
    • EditMasm
Re: TYPE and real
« Reply #3 on: November 03, 2020, 12:59:10 AM »
 :thumbsup:
Many thanks
Fa is a musical note to play with CL