I was going through GATE-CS questions, while solving I came across the following question here.
Write short answers to the following:
Which of the following macros can put a macro assembler into an infinite loop?
.MACRO M1,X .IF EQ,X ;if X=0 then M1 X+1 .ENDC .IF NE,X ;IF X≠0 then .WORD X ;address (X) is stored here .ENDC .ENDM
.MACRO M2,X .IF EQ,X M2 X .ENDC .IF NE,X .WORD X+1 .ENDC .ENDM
Give an example call that does so.
The actual question I guess had no explanation of what each line of the macro meant, but here from another site got to know the meaning of the lines apparently.
Please can anyone tell one tell me, what are these types of macros? [I know what are macros in C. Also know that the C processor, substitutes the macros in the actual line of the code. I mean to say that I am not unaware of what macro is but I want to know about it in detail.]
But I want to know what is the syntax of writing these above macros, where are they are used? And the general method/theory of macro expansions. The above question is tagged under "assembler". What is its connection with assembly language? Are these macros written in some assembly language?
Could anyone recommend me a textbook, which shall help me build concepts on these topics? I could not find myself as I do not know what language are these macros are written in, also I do not know their meaning...