Chapter 2 2 ( Leehland) Flashcards
(25 cards)
Role of Assembler
Source code is converted into the object code
Linker
Object code is converted into the executable code.
Loader
It loads the executable code onto the memory (RAM) for it to get executed by CPU.
Fundamental functions of the Assemblers
Translating the mnemonic operation codes to their machine language equivalent.
Assigning the machine addresses to the symbolic labels.
Assemblers are machine dependent as they have different machine instructions format and _______
codes
Data Transfer (RD, WD)
The end of each record is marked with the null character(00[subscript-16])
The end of the file is indicated by the zero-length record.
Subroutines(JSUB, RSUB)
(RDREC, WRREC)
Saves the link register first before the nested jump.
Pseudo Instructions
Providing instructions to the Assembler.
Not translated into the machine instructions.
Basic Assembler Directive
START
END
BYTE
WORD
RESW
RESB
Object Program
Header
Text
End
End
E
Address of the first executable instruction (hex)
(END_PROGRAM NAME)
TEXT
T
Starting address int his record (hex)
Length of the object code in this record int he bytes (hex)
Object code (69-10+1)/6 =10 instructions
Header
H
Program name
Starting address (hex)
Length of the object program in bytes (hex)
Assembler’s other functions
Convert the data constant into the internal machine representations
Build the machine instructions in the proper format
Write the object t program and the assembly listing.
Forward reference
reference that is defined later in the program
Two Pass Assembler:
Pass 1
Assign the addresses to all the statements in the program
Save the values assigned to all labels for use in Pass 2
Perform some processing of Assembler directives
Pass 2
Assemble insrtuctions
Generate data values defined by the BYTE, WORD
Perform processing of Assembler directives not done in Pass 1
Write the object program and the assembly listing
Data Structure in the assembler
Operation Code (OPTAB)
Symbol Table (SYMTAB)
Location Counter (LOCCTR)
OPTAB
Content: menmonic, machine code (instruction format, length )etc.
Characteristic: static table
Implementation: array or hash table (easy for search)
SYMTAB
Content: label name, value, flag, (type, length), etc.
Characteristic: Dynamic table (insert, delete, search)
Implementation: hash table, hashing function, non-random keys
Machine Depedent Assembler Features
Instruction formats and addressing modes
Program relocation
Machine Independent Assembler Features
Literals
Symbol-defining statements
Expressions
Program Blocks
Control sections and program linking
Register Translation
Register Name: A, X, L, B, S, T, F, PC, SW
Their values: 0, 1, 2, 3, 4, 5, 6, 8, 9
Address translation
register-memory instructions use program counter relative or base relative addressing (op m)
Format 3: 12-bit address field
base relative: 0-4095
pc-relative: -2048 - 2047
Format 4: 20-bit address field