edited by
1,960 views
7 votes
7 votes

Write short answers to the following:

  1. Which of the following macros can put a macro assembler into an infinite loop?
.MACRO M1,X
.IF EQ,X
M1 X+1
.ENDC
.IF NE,X
.WORD X
.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.

edited by

1 Answer

Best answer
11 votes
11 votes
Macro $M_2$ can put the macro assembler into an infinite loop when called with $M_2(0)$

$(EQ(X)$ is TRUE when $X = 0)$

For $M_1$ the argument $X$ is incremented for the recursive call and so the macro expansion will happen maximum $2$ times.

Related questions

16 votes
16 votes
4 answers
1
Kathleen asked Sep 12, 2014
3,481 views
The purpose of instruction location counter in an assembler is _______
17 votes
17 votes
2 answers
2
Kathleen asked Sep 13, 2014
4,490 views
Mention the pass number for each of the following activities that occur in a two pass assembler:object code generationliterals added to literal tablelisting printedaddres...