Viva Questions
Viva Questions
11. What is the use of the variable LOCCTR (location counter) in assembler?
This variable is used to assign addresses to the symbols. LOCCTR is
initialized to the beginning address specified in the START statement. After each source
statement is processed the length of the assembled instruction or data area to be generated is
added to LOCCTR and hence whenever we reach a label in the source program the current
value of
LOCCTR gives the address associated with the label.
12. Define load and go assembler.
One pass assembler that generates their object code in memory for
immediate execution is known as load and go assembler. Here no object programmer is
written out and hence no need for loader.
13. What are the two different types of jump statements used in MASM assembler?
* Near jump
A near jump is a jump to a target in the same segment and it is
assembled by using a current
code segment CS.
* Far jump
A far jump is a jump to a target in a different code segment and it is
assembled by using different segment registers .
14.
15. Differentiate the assembler directives RESW and RESB.
RESW -It reserves the indicated number of words for data area.
Eg: 10 1003 THREE RESW 1
In this instruction one word area (3 bytes) is reserved for the symbol
THREE. If the memory is byte addressable then the address assigned for the next symbol is
1006.
RESB -It reserves the indicated number of bytes for data area.
Eg: 10 1008 INPUT RESB 1
In this instruction one byte area is reserved for the symbol INPUT .Hence the address
assigned for the next symbol is 1009.
16. Define modification record and give its format.
This record contains the information about the modification in the object code during
program relocation. the general format is Col 1 M
Col 2-7 Starting location of the address field to be modified relative to the beginning of the
program
Col 8-9 length of the address field to be modified in half bytes.
17. Write down the pass numbers (PASS 1/ PASS 2) of the following activities that
occur in a two pass assembler:
a. Object code generation
b. Literals added to literal table
c. Listing printed
d. Address location of local symbols
Answer:
a. Object code generation - PASS 2
b. Literals added to literal table - PASS 1
c. Listing printed - PASS2
d. Address location of local symbols - PASS1
18. What is meant by machine independent assembler features?
The assembler features that do not depend upon the machine
architecture are known as machine independent assembler features.
Eg: program blocks, Literals.
22. What is the difference between the assembler directive EXTREF and EXTDEF.
EXTDEF names external symbols that are defined in a particular control
section and may be used in other sections. EXTREF names external symbols that are referred
in a particular control section and defined in another control section.
4. Define loader.
Loader is a set of program that loads the machine language translated by the translator into
the main memory and makes it ready for execution.
7. Give any two differences between base relative addressing and program counter
Here the second operand is given in indirect addressing mode. First the word in memory
location 600 is fetched and which will give the address of the operand.
9. Define immediate addressing.
In this addressing mode the operand value is given directly. There is no need to refer
memory. The immediate addressing is indicated by the prefix ‘#’.
Eg: ADD #5
In this instruction one operand is in accumulator and the second operand is an immediate
value the value 5 is directly added with the accumulator content and the result is stored in
accumulator.
13. What is the name of A and L register in SIC machine and also specify its use.
A-accumulator
Used for arithmetic operation. i.e., in the case of arithmetic operations one operand is in the
accumulator, and other operand may be an immediate value, register operand or memory
content. The operation given in the instruction is performed and the result is stored in the
accumulator register.
L-linkage register
It is used to store the return address in the case of jump to subroutine (JSUB) instructions.
14. What are the instruction formats used in SIC/XE architecture? Give any one
format.
Format 1 (1 byte), Format 2 (2 bytes), Format 3 (3 bytes) & Format 4(4
bytes)
Format 2:
844
OPCODE R1 R2
16. What is the difference between the instructions LDA # 3 and LDA THREE?
In the first instruction immediate addressing is used. Here the value 3 is directly loaded into
the accumulator register. In the second instruction the memory reference is used. Here the
address(address
assigned for the symbol THREE) is loaded into the accumulator register.
20. Write the sequence of instructions to perform the operation BETA = ALPHA + 1
using SIC instructions.
LDA ALPHA
ADD ONE
STA BETA
…. ….
ALPHA RESW 1
BETA RESW 1
ONE RESW 1