0% found this document useful (0 votes)
3 views

Spcc

The document explains macros and macro expansion, highlighting their convenience for programmers and the two methods of expansion: macro assembler and macro pre-processor. It also covers the features of macros, the two-pass macro processor, and various assembly language statements, including imperative and declarative statements. Additionally, it describes the roles of loaders, linkers, text editors, and debuggers in programming, along with a brief mention of single-pass assemblers and nested macro calls.

Uploaded by

riyashaikh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Spcc

The document explains macros and macro expansion, highlighting their convenience for programmers and the two methods of expansion: macro assembler and macro pre-processor. It also covers the features of macros, the two-pass macro processor, and various assembly language statements, including imperative and declarative statements. Additionally, it describes the roles of loaders, linkers, text editors, and debuggers in programming, along with a brief mention of single-pass assemblers and nested macro calls.

Uploaded by

riyashaikh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

QB TT1

1. Explain macro and macro expansion. Different features of macros with examples.
Macro:
●​ Macro instruction is a notational convenience for the programmer. For every
occurrence of macro, the whole macro body or macroblock of statements gets
expanded in the main source code. Thus Macro instructions make writing code more
convenient.
●​ Macro definition may be written using formal parameters . A macro call on such a
macro specifies actual parameters.
Macro Expansion:
Macro Expansion can be performed by using two kinds of language processors and when
we use of macro name with a set of actual parameters is replaced by same code generated
from its body .This is called macro expansion.
Macro expansion can be performed two ways:
●​ macro assembler
●​ macro pre-processor
Macro Assembler : It performs expansion of each macro call in a program into a sequence
of assembly language statements and also assembles the resultant assembly language
program.​
Macro pre-processor: It only processes the macro call . Other statements are processes
with the help of assembler a macro pre-processor merely performs expansion of macro in
program. It produces an assembly program in which a macro call has been replaced by
statements that resulted from its expansion but statements that were not macro calls have
been retained in their original from . This program can be assembled by using assembler.
Features of Macro:
●​ Macro represents a group of commonly used statements in the source programming
language.
●​ Macro Processor replaces each macro instruction with the corresponding group of
source language statements. This is known as the expansion of macros.
●​ Using Macro instructions programmer can leave the mechanical details to be handled
by the macro processor.
●​ Macro Processor designs are not directly related to the computer architecture on
which it runs.
●​ Macro Processor involves definition, invocation, and expansion.

2. Explain two - pass macro processor with a flowchart.


Two Pass Macro Processor:
3. Design and explain flow chart of two pass assembler.
4. Explain the data structures used in TPASM.

Base Table (BT) which indicates which register is used as base register and what its
contents are.
5. Explain different types of statements used in assemblers with respect to system
programming.
Assembly Language Statement:
1.​ Imperative Statements:
Imperative statements in assembly language are instructions that explicitly specify
the operations to be performed by the computer's central processing unit (CPU).
These statements provide step-by-step instructions for the processor to execute.
MOV AX, 5 ; Move the value 5 into register AX
ADD AX, 3 ; Add 3 to the value in register AX
Purpose: Directly map to machine instructions, telling the processor what actions to
perform.
2.​ Declarative statements:
Declarative statements in assembly language are used to declare data or define
structures without directly specifying the sequence of operations to be performed.
These statements are often used to reserve memory space for variables, constants,
or data structures.
DATA_SEG SEGMENT
VAR1 DW 0 ; Declare a 16-bit word variable VAR1 and initialize it to 0
ARRAY DB 10 DUP(?) ; Declare an array of 10 bytes without initializing
DATA_SEG ENDS
Purpose: Define data, labels, or constants, providing information for the assembler
rather than generating executable code.

6. Compare between Compiler and Interpreter.


7. Write short note on: Loader, Linker, text editors, debuggers.
Loader:
A loader is the part of an operating system that is responsible for loading programs. It is one
of the essential stages in the process of starting a program, as it places programs into
memory and prepares them for execution. Loading a program involves reading the contents
of the executable file containing the program instructions into memory, and then carrying out
other required preparatory tasks to prepare the executable for running. Once loading is
complete, the operating system starts the program by passing control to the loaded program
code.

Linker:
A linker is a program that combines object modules to form an executable program. Many
programming languages allow us to write different pieces of code, called modules,
separately. This simplifies the programming task because we can break a large program into
small, more manageable pieces. Eventually, though, we need to put all the modules
together. This is the job of the linker. In addition to combining modules, a linker also replaces
symbolic addresses with real addresses. Therefore, we may need to link a program even if it
contains only one module.
Text Editors:
A text editor is a type of program used for editing plain text files. Text editors are often
provided with operating systems or software development packages. Example for text
editors are Microsoft word, gedit in Linux etc.

Debugger:
A debugger is a tool that allows you to examine the state of a running program. Debugging is
the process of locating and then removing bugs or errors in a program. An interactive
debugging system gives programmers tools to help them test and debug their programs.
Debugging is the methodical process of locating and eliminating bugs or defects in a
computer program.
Types of Debuggers:
●​ Static debugger: A static debugger does not rely on any specific software. The
debugging can be completed by the user.
●​ Dynamic debugger: A dynamic debugger can be either software or hardware.

8. Explain Single pass Assembler.


9. Write a short note on functions of macro processor in detail.
10. Write a short note on nested macro call.

You might also like