Revision Session Assembler Macro Processor - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

Revision Session Assembler Macro Processor

Description:

Explain the pass-1 algorithm of two-pass algorithm design? ... CBLK is used to indicate the data definition block which stores block of data. ... – PowerPoint PPT presentation

Number of Views:205
Avg rating:3.0/5.0
Slides: 28
Provided by: VTU1
Category:

less

Transcript and Presenter's Notes

Title: Revision Session Assembler Macro Processor


1
Revision SessionAssemblerMacro Processor
2
Q. translate the following assembly program to
SIC/XE object code TEST    START   0FIRST   
LDA     3         STX     THREE         LDX  
   0        LDS     THREE         ADDR   
A,X        STA     RESULT,X RESULT   RESW   
1 THREE    RESW    1         END     FIRST
3
Answer
QUIZ2 START 0 FIRST LDA 3
STX THREE LDX 0 LDS
THREE ADDR A,X STA RESULT,X
RESULT RESW 1 THREE RESW 1 END
FIRST
0000 0003 0006 0009 000D 000F 0013 0016
010003 132010 050000 6F100016 9001 0F900013
4
Q. translate the following assembly program to
SIC/XE object code QUIZ3   START   0 FIRST   
LDA     3 STX     THREE        
LDX     0        LDS     THREE        
ADDR    A,X        STA    
RESULT,X RESULT   RESW    1 THREE    RESW   
1         END     FIRST
5
Answer
QUIZ3 START 0 FIRST LDA 3
STX THREE LDX 0
LDS THREE ADDR A,X
STA RESULT,X RESULT RESW 1 THREE
RESW 1 END FIRST
0000 0003 0006 0009 000D 000F 0013 0016
010003 132010 050000 6F100016 9001 0F900013
6
Explain the pass-1 algorithm of two-pass
algorithm design?
7
(No Transcript)
8
  • Q. Explain the various data structures required
    by pass-1?
  • Ans The data structures are
  • LOCCTR It is a variable which keeps track of the
    address of the next instruction.
  • SYMTAB This is a table which maintains the
    details of the symbols (labels) encountered in
    the program.
  • This table has the entries for symbol name,
    symbol value, and the flag (which indicates the
    error)
  • OPTAB this table consists of all the mnemonic
    codes and their object codes.

9
  • Q. What are the various records which are
    maintained in the object file.
  • Ans The various records maintained in the object
    file is
  • Header Record
  • Text Record

End Record
10
(No Transcript)
11
Q. What are machine-Dependent features? Ans The
machine-dependent features are those which depend
on the architecture of the machine. In an
assembly language program these features are
instruction set, addressing modes and the concept
of relocation. Each machine has its own
instruction set with different form of
representations. In SIC/XE there are 4 different
instruction formats. Addressing modes also depend
on the machine. As in SIC we have only three
addressing modes, whereas in SIC/XE machine we
have 5 addressing modes. Program relocation if
the program is to be loaded at a different
location other than the address mentioned in the
START instruction of the program then the program
is relocated to a new location. The instruction
which refer direct address get affected by the
relocation.
12
Q. What are machine-independent features in
assembler design? Ans The machine-independent
features are the ones which does not depend on
the machine architecture. These are Literals,
Symbol defining statements, expressions, program
blocks, control sections. Literal Literal is
defined as with the prefix followed by
specification of the literal value. The example
is shown below
13
Literal example
14
For the other machine-independent features refer
the Slides Assem-4 of session 4.
15
Q. What are program blocks? Ans The source
program logically maintain subroutines, data
areas, etc and are handled as single unit. The
different segments of the code are rearranged
into a single unit called program blocks. Usually
three blocks are used defult blk, CDATA blk, and
CBLK. CBLK is used to indicate the data
definition block which stores block of
data. CDATA is used to indicate the part of the
code indicating the data definition. Rest is
considered as default blk. Directive USE is used
to define these blocks.
16
(No Transcript)
17
(No Transcript)
18
(No Transcript)
19
Q. What are control sections? Ans Control
sections are the segments of the code that are
translated into independent object programs. The
programmer can assemble, load and manipulate each
of the control segments separately. Assembler
directive CSECT is used to indicate the beginning
of the control segments.
20
(No Transcript)
21
(No Transcript)
22
  • Q How is forward reference resolved in
    single-pass assembler?
  • Ans Omits the operand address if the symbol has
    not yet been
  • defined
  • Enters this undefined symbol into SYMTAB and
    indicates that it
  • is undefined
  • Adds the address of this operand address to a
    list of forward
  • references associated with the SYMTAB entry
  • When the definition for the symbol is
    encountered, scans the
  • reference list and inserts the address.
  • At the end of the program, reports the error if
    there are still
  • SYMTAB entries indicated undefined symbols.

23
(No Transcript)
24
(No Transcript)
25
Q. What is a macro processor? Ans Macro allows
the programmer to write short hand
programs. There will be a macro instruction in
the program. Which is replaced by its equivalent
code. The basic function are Invocation,
Expansion. Macro invocation gives the name of
the macro to be invoked and the parameters to be
used. Macro name P1, P2, . . Macro
expansion expands the macro incstruction with its
equivalent instruction block.
26
Macro Invocation
27
Wishing All the Students All the Very Best
Write a Comment
User Comments (0)
About PowerShow.com