The MASM Forum

Miscellaneous => Irvine Book Questions. => Topic started by: Luke on October 20, 2020, 05:33:07 PM

Title: Re: A2094: Operand Must be Relocatable?
Post by: Luke on October 20, 2020, 05:33:07 PM
Add an actual parameter, compare it with the formal parameter, it can be debugged, but according to my experience, the assembler will only compare the size of the two actual parameter addresses.

mLocate MACRO xval,yval,haha
  mov haha,0
IF xval lt haha
  exitm
ENDIF
IF yval lt haha
  exitm
ENDIF
......
ENDM

This can be debugged successfully, but it seems that the assembler only compares the size of the formal parameter memory address, not the size of the data pointed to by the memory
It's better to use cmp jl to jump to the end of the macro

mLocate MACRO xval,yval
local L1
  cmp xval,0
  jl L1
  cmp yval,0
  jl L1
......
L1 :
ENDM