flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > eqtype eax or xmm ?

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1251
Roman
Fasmw 1.73
How know from eqtype this is reg eax or xmm1 ?
I want do this macro x_mov
Code:
x_mov xmm1,FromA,x,y,z
;get this code
movss xmm1,[FromA]
movss [x],xmm1
movss [y],xmm1
movss [z],xmm1

x_mov eax,FromA,x,y,z
;get this code
mov eax,[FromA]
mov [x],eax
mov [y],eax
mov [z],eax
    
Post 18 Aug 2022, 10:25
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1251
Roman
I try this but error
Code:
macro x_mov a,b {
      if a eqtype eax
      mov a,[b]
      else
      movss a,[b]
      end if
      } 
;in code
cerr       dd 1.0,2.0,3.0 ; when i write err fasm write extra word used. What is mean ?
x_mov eax,cerr
x_mov xmm1,cerr ;fasm get error mov xmm1,[cerr]
    
Post 18 Aug 2022, 10:41
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 652
Location: Russia
macomics
2.2.5 Other directives wrote:
The err directive immediately terminates the assembly process when it is encountered by assembler.

Code:
macro x_mov a,b {
  if a in <eax, ebx, ecx, edx, esp, ebp, esi, edi>
    mov a, [b]
  else if a in <xmm0, xmm1, xmm2. xmm3, xmm4, xmm5, xmm6, xmm7>
    movss a, [b]
  end if
}    
Post 18 Aug 2022, 10:57
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1251
Roman
Thanks. Work perfect !
Post 18 Aug 2022, 11:02
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.