Literals - A Machine Independent Feature

21h16charis 29 views 9 slides Jul 22, 2024
Slide 1
Slide 1 of 9
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9

About This Presentation

Introduction to Literals, A machine independent feature. The presentation is based on the prescribed textbook for System Software and Compiler Design, Computer Science and Engineering - System Software by Leland. L. Beck,
D Manjula.


Slide Content

LITERALS MACHINE INDEPENDENT FEATURES SSCD

The features which are NOT closely dependent to machine architecture are called machine independent assembler features. The machine independent assembler features includes: 1. Literals 2. Symbol Defining Statements 3. Expressions 4. Program Blocks 5. Control Sections and Program Linking

A literal is defined with a prefix '=' followed by a specification of the literal value. 001D

What then is the difference between literal operands and immediate operands ? In immediate addressing , the operand value is part of the machine instruction, i.e. there is no memory reference . Line no Location Counter 55 0020 LDA #03 010003 With a literal , the assembler generates the specified value as a constant at some other memory location . The address of this generated constant is used as the TA for the machine instruction

All the literal operands used in the program are gathered together into one or more literal pools which are placed at the end of the program. When the assembler encounters LTORG statement, it creates a literal pool that contains all of the literal operands used since the previous LTORG or the beginning of the program. Reason: Keep the literal operand close to the instruction Literal pools

Name Operand value Lenght Address The assembler handles literal operands making use of a data structure called the literal table (LITTAB). Organized as a Hash table. LITTAB

How are literals implemented? Name Operand value Lenght Address EOF 454846 3 Name Operand value Lenght Address EOF 454846 3 2020D PASS 1: When END or LTORG encountered during Pass 1, scan the LITTAB and assign an address to each literal not yet assigned an address. Literal is added to the LITTAB, if not present, leaving address unassigned

How are literals implemented? PASS 2: The assembler searches the LITTAB for each literal encountered in the instruction and replaces it with its equivalent value as if these values are generated by BYTE or WORD.