Oxygen Basic
		Programming => Problems & Solutions => Topic started by: Brian Alvarez on March 18, 2020, 12:21:28 PM
		
			
			- 
				
 Hello Charles, are macrofunctions supposed to support quads?
			 
			
			- 
				Yes, macro functions can be of any type.
			
 
			
			- 
				 This does not compile (v1 and v2 are dwords)
macro ¤OR quad(r, v1, v2)  
  r = v1 or v2
end macro
ERROR: ASSEMBLER:
 ERR:	qword [ebp-60]!!  Unidentified instruction: qword
LINE:	2083
FILE:	"main source
this compiles but after a few calls to the function other areas of the program start to fall apart:
FUNCTION ¤OR(byval quad v1, v2) as quad
  addr rcx,v1
  addr rdx,v2
  mov eax,[rcx]
  or eax,[rdx]
  mov [rcx],eax
  mov eax,[rcx+3]
  or eax,[rdx+3]
  mov [rcx+3],eax
  return v1 
end function
This works and it is completely stable but does not work with quads:
macro ¤OR dword(r, v1, v2)  
  r = v1 or v2
end macro
			 
			
			- 
				 I found a workaround but im not sure how big is the cpu footprint:
FUNCTION ¤OR2(byval quad v1, v2) as quad
  addr rcx,v1
  addr rdx,v2
  mov eax,[rcx]
  or eax,[rdx]
  mov [rcx],eax
  mov eax,[rcx+3]
  or eax,[rdx+3]
  mov [rcx+3],eax
  return v1 
end function
macro ¤OR quad(r, v1, v2)  
  r = ¤OR2((quad)v1, (quad)v2)
end macro
			 
			
			- 
				The quad type does not support bitwise operations directly. You can use sys instead for 64bit mode.
			
 
			
			- 
				Would that allow bitwise operations on quads for 32bit mode?