Escolar Documentos
Profissional Documentos
Cultura Documentos
In Numeric Format, represents numeric values with one digit per byte. In
this format, the sign may appear either in the last byte, or as a separate byte
preceding the first digit. These two variations are called trailing numeric and
leading separate numeric.
Unit –2 Assemblers
1. What are the fundamental functions of Assemblers?
The fundamental functions of Assemblers are,
1. Translating mnemonic operation codes to their machine language
equivalents.
2. Assigning machine addresses to symbolic labels used by the
programmer.
10.Give some of the advantages of SIC/XE features when compared with SIC.
The advantages of SIC/XE architectures are
1. Improves the execution speed of the program :register to register instruction
faster because they do not require another memory reference.Likewise ,
when using immediate addressing the operand is already present as part of
the instruction,and need not be fetched from anywhere.
2. The use of indirect addressing often avoids the need for another instruction.
11.What are the different types of notations used prefix to operand and mnemonic
code.
1.Immediate addressing - #
2.Indirect addressing - @
3.Format 4 - +
In this case the assembler would not know what value to assign to the
location counter in response to the first ORG statement .AS a result the symbols
BYTE 1, BYTE 2 and BYTE 3 could not be assigned the addresses during pass 1.
21.Give one example for calculation of target address with respect to B and P bits in
instruction format.
Consider the following instruction
0000 STL RETADR –17202D
Opcode ni xbpe
Opcode of STL is 172, in Binary 0001 0111 0010
In this E bit is 0, so it is in Format 3.
P bit is 1, so it is Program counter relative.
Program counter value is 0003.Address of RETADR is 00030.
Therefore opcode of RETADR is 0030-0003,which is equal to 002D.
The symbol BETA cannot be assigned a value when it is encountered during the
first pass because DELTA has not yet been defined. As a result, ALPHA cannot be
evaluated during the second pass. This means that any assembler that makes only two
sequential passes over the source program cannot resolve such a sequence of definitions.
The General solution for this is a multipass assembler that can make as many passes as
are needed to process the definition of symbols.
If LENGTH is defined at address 0033 with the value 5. The result of the
given statements are
a. A is loaded with value 5 and subtracted by 1, thus giving the result 4.
b. A is loaded with value defined in location 0032.
2. if the result is less than 10, then it is the resultant hexadecimal value,
otherwise from the resultant value subtract decimal 7 which is the resultant
hexadecimal value of the given input.
INCLUDE program-name(library-name)
-directs the loader to read the designated object program from a library and treat it
as if it were part of the primarily loader input.
DELETE csect-name
-instruct the loader to delete the named control section(s) from the set of programs
being loaded.
CHANGE name1,name2
-cause the external symbol name1 to changed to name2 wherever it appears in the
object program.
12. What are the other Loader design options other than Linking Loader.
The other Loader design options are,
1. Linkage editor performs linking and some relocation; however, the linked
program is written to a file or library instead of being immediately loaded
into memory.
2. Dynamic Linking, which uses the facilities of an operating system to load and
link subprograms at the time they are first called.
UNIT-4 Macroprocessors
1. Define a macroinstruction.
The macroinstructions allow the programmer to write a shorthand version
of a program. A macro represents a commonly used group of statements in the
source programming language. These macros are expanded by the macro
processor in the source program and then fed as input to assembler.
2. Compare macro with subprogram.
1. It is necessary to save contents of all registers individually before calling a
subprogram, whereas the registers are saved in macro using single
instruction SAVEREGS. Also LOADREGS could be used to reload the
register contents after returning from the subprogram.
2. When subprogram is called control is transferred from calling instruction
address to called instruction address, thus it is necessary to save the return
address in the linkage register, whereas the macros on invocation are
expanded at the invoked location so there is no need to save the return
address.
3. What are the functions of macro processor or preprocessor?
The functions of a macro processor or preprocessor are substitution of one group of
characters or lines for another. A macro invocation statement gives the name of the
macroinstruction being invoked and arguments to be used in expanding the macro.
On macro invocation the macro processor expands the macro definition in the
source program and this expanded program is fed as input to the assembler.
7.How can we avoid duplication of label when macro is invoked more than once?
Labels used within the macro body begin with special character ‘$’. Each symbol
beginning with ‘$’ will be replaced by “$xx”, where xx is a two character alphanumeric
counter of the number of macroinstructions expanded. For the first macro expansion on a
program,” xx “ will have the value “AA” .For succeeding macro expansions, xx will be
set to AB ,AC etc.. This results in the generation of unique labels for each expansion of a
macroinstruction.
13. What do you understand by term recurrence with reference to macro expansion?
On invocation of one macro inside another macro, after expansion of
invoked macro the expand flag is set as false, thus the control does not return to invoking
macro. This will make incomplete expansion of invoking macro, in order to solve this
problem recursive macro expansion has to be done. So that expansion is complete for
both invoking and invoked macro.
14. State how posititional parameters and arguments are related in a macroprocessor.
When a macro invocation statement is recognized, the arguments are stored in
ARGTAB according to their position in the argument list. The positional notation is used
for the parameters, i.e for first parameter is converted to ?1, for second ?2,
correspondingly for all parameters in the DEFTAB. As the macro body is expanded,
arguments from ARGTAB are supplied to corresponding index in DEFTAB and
substituted for the corresponding parameters in the macro body.