Explain advanced assembler directives with suitable example.
Question
Explain advanced assembler directives with suitable example.
Solution
Assembler directives are instructions that direct the assembler to do something. These directives are not translated into machine instructions, but they may influence the assembly process. Advanced assembler directives are used to control the organization of the program and its data space.
Here are some examples of advanced assembler directives:
- EQU: This directive is used to give a name to some value or to a symbol. Once a symbol is defined with EQU, it cannot be altered or redefined.
Example:
COUNT EQU 10
In this example, the symbol COUNT is defined as 10. Anywhere in the program, if COUNT is used, it will be replaced by 10.
- ORG: This directive is used to set the location counter to a specified value. The location counter keeps track of the current location in the memory where the instructions or data are being loaded.
Example:
ORG 100h
In this example, the location counter is set to 100h. The next instruction or data will be placed at this location in the memory.
- DB, DW, DD, DQ, DT: These directives are used to declare and initialize data in the memory. DB is used for byte, DW for word, DD for double word, DQ for quadword, and DT for ten bytes.
Example:
DATA DB 'HELLO'
In this example, a byte type data 'HELLO' is declared and initialized.
- END: This directive is used to tell the assembler that this is the end of the source code.
Example:
END
In this example, the assembler is directed to stop assembling.
- INCLUDE: This directive is used to tell the assembler to include a file in the source code.
Example:
INCLUDE 'filename'
In this example, the assembler is directed to include the file 'filename' in the source code.
- EXTRN: This directive is used to tell the assembler that a variable or procedure is defined in another module.
Example:
EXTRN variable
In this example, the assembler is directed that 'variable' is defined in another module.
- PUBLIC: This directive is used to declare a variable or procedure that can be used by other modules.
Example:
PUBLIC variable
In this example, 'variable' is declared as public and can be used by other modules.
Similar Questions
Explain and show usage by giving examples of following assembler directives: ORIGIN,EQU, LTORG, START
Explain six basic SIC assembler directives.
Assembly directive are used .?
Differentiate between assembler and compiler as used in computing world.
Explain the data structures used in the pass1 algorithm of an assembler with a suitable example
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.