Assembler

Embed Size (px)

Citation preview

Assemblers

Design of 2-Pass AssemblersAgenda Introduction Advanced Assembler DirectivesORIGINEQULT ORGPass I of the AssemblerData Structure used in Pass IOPTAB SYMTABLITTABPOOLTABAlgorithmIntermediate codeDeclaration and Assembler Directive Processing Pass II of the AssemblerIntroductionSourceProgramAssemblerObjectCodeLoaderExecutable CodeLinkerConvert mnemonic operation codes to their machine language equivalentsConvert symbolic operands to their equivalent machine addresses Build the machine instructions in the proper formatConvert the data constants to internal machine representationsWrite the object program and the assembly listingIntroductionTwo Pass Assembler Read from input lineLABEL, OPCODE, OPERANDPass 1Pass 2 IntermediatefileObject codesSourceprogramOPTABSYMTABSYMTABIntroduction: Design of 2 - Pass AssemblerPass 1Separate the Symbol, Mnemonic opcode and operand fieldsBuild the symbol tablePerform LC Processing Construct Intermediate RepresentationPass 2Synthesize the target programAdvanced Assembler DirectivesORIGINEQU

Advanced Assembler DirectivesORIGINEQU

Syntax: ORIGIN < Address Specification>

Advanced Assembler DirectivesORIGINEQU

Syntax: EQU

E.g. MAXLENEQU4096Pass I of AssemblerPass I Uses following Data StructuresOPTABSYMTABLITTABPOOLTABPass I of AssemblerPass I Uses following Data StructuresOPTAB : A Table of Mnemonics & related infoSYMTABLITTABPOOLTAB

Pass I of AssemblerPass I Uses following Data StructuresOPTABSYMTAB: Symbol TableLITTABPOOLTAB

Pass I of AssemblerPass I Uses following Data StructuresOPTABSYMTABLITTAB: Table of Literals used in programPOOLTAB

Pass I of AssemblerPass I Uses following Data StructuresOPTABSYMTABLITTABPOOLTAB: A table of information concerning literal pool

Algorithm

Algorithm