retagged by
1,567 views

3 Answers

2 votes
2 votes
Macro Expansion is all about changing the macro definitions to the respective related code

while  assembler runs through it resolves all the definitions related to it  

like if write something like the value will get replaced all these
0 votes
0 votes
in two processor micro processor all the macro definitions are processed during the first pass it self. so macro expansions are done in pass 1 only.
0 votes
0 votes

Macro expansion is done in pass one instead of pass two in a two-pass macro assembler because pass one is responsible for generating the expanded source code and identifying the locations of macro calls, while pass two is primarily concerned with generating the final machine code or object code.

Here are the main reasons for macro expansion in pass one:

  1. Source Code Generation: Pass one focuses on the generation of the expanded source code by substituting the macro calls with their corresponding macro bodies. This process produces an extended source code that includes the actual instructions resulting from macro expansion.

  2. Identifying Macro Calls: During pass one, the macro calls are identified and replaced with their macro bodies. The locations of these macro calls and their expanded code are recorded, allowing the assembler to efficiently handle them in pass two.

  3. Location Counter Updates: The location counter (LC) is updated in pass one as the macro instructions are expanded. The assembler needs to keep track of the addresses where the macro instructions are expanded to ensure proper addressing in the final output.

  4. Parameter Handling: Pass one handles the evaluation of parameters and argument substitution. It ensures that the parameters in the macro body are appropriately replaced by the actual arguments provided in the macro call.

Related questions

10 votes
10 votes
1 answer
1
Kathleen asked Sep 12, 2014
5,517 views
Maximum number of edges in a planar graph with $n$ vertices is _____
11 votes
11 votes
1 answer
2
Kathleen asked Sep 12, 2014
3,163 views
A simple and reliable data transfer can be accomplished by using the 'handshake protocol'. It accomplishes reliable data transfer because for every data item sent by the ...
37 votes
37 votes
10 answers
3
Kathleen asked Sep 12, 2014
17,464 views
Complexity of Kruskal’s algorithm for finding the minimum spanning tree of an undirected graph containing $n$ vertices and $m$ edges if the edges are sorted is _______
7 votes
7 votes
4 answers
4
Kathleen asked Sep 12, 2014
3,099 views
Many of the advanced microprocessors prefetch instructions and store it in an instruction buffer to speed up processing. This speed up is achieved because ________