UMBC CMSC 211

UMBC | CSEE


IFs Usable Only in Macros

There are two more IF psuedo-operators that only work inside a Macro definition, IFB/IFNB and IFDIF/INDIFI (The last "I" is for case insensitive.

IFB is to check the macro parameter to see if it is blank. Let's look at an example:

_PutCh	MACRO c1, c2, c3, c4, c5

	    mov	ah, 2         ;DOS function code for display character
		IRP	c, <&c1&, &c2&, &c3&, &c4&, &c5&>
IFNB <&c&>
		mov	dl, &c&
ENDIF
		int	21h
		ENDM
   

Of course, IRP is covered in the next chapter on dealing with string! What this macro does is check to see if the parameter is non-blank, and if it is, it will move the parameter to the DL register.


UMBC | CSEE