assembler
DESCRIPTION
TRANSCRIPT
ASSEMBLER
Assembler
General Design Procedure:
1. Specify the Problem
2. Specify Data Structure
3. Define Format of Data Structure
4. Specify Algorithm
5. Look for modularity
6. Repeat 1 through 5 on modules
Statement of problem
Pass 1 purpose: Define symbols and literals
Determine length of machine instructions
(MOTGET1)
Keep track of location counter (LC)
Remember values of symbols until pass 2
(STSTO)
Process some pseudo ops, e.g. EQU, DS
(POTGET1)
Remember literals (LITSTO)
Pass 2 purpose: Generate object program
Look up value of symbols
(STGET)
Generate instructions (MOTGET2)
Generate data (for DS, DC and
literals)
Process pseudo ops(POTGET2)
Data Structure Pass 1 data bases:
1. Input source program
2. A Location Counter (LC), used to keep track of each
instruction’s location.
3. A table, the Machine Operation Table (MOT), that
indicates the symbolic mnemonics for each instruction
and its length
4. A table, the Pseudo Operation Table (POT), that
indicates the symbolic mnemonics and action to be
taken for each pseudo-op in pass 1
Data Structure
5. A table, the Symbol Table (ST), that is used to
store each label and its corresponding value.
6. A table, the Literal Table (LT), that is used to
store each literal encountered and its
corresponding assigned locations.
7. A copy of the input to be used later by pass
2. this may be stored in a secondary storage
device.
Data Structure
Pass 2 data bases:
1. Copy of source program input to pass 1
2. Location Counter (LC)
3. A table, the Machine Operation Table (MOT), that
indicates for each instruction: i) symbolic mnemonics
ii)length iii)binary machine op code and iv) format
4. A table, the Pseudo Operation Table (POT), that
indicates for each pseudo op the symbolic
mnemonics and the action to be taken in pass 2
Data Structure
5. The Symbol Table (ST), prepared by pass 1, containing
each label and its corresponding value.
6. A table, the Base Table (BT), that indicates which registers
are currently specified as base registers by USING pseudo-
ops and what are the specified contents of these registers.
7. A work space, INST, that is used to hold each instruction
as its various parts are being assembled together.
Data Structure
8. A workspace, PRINT LINE, used to
produce a printing listing
9. A workspace, PUNCH CARD, used prior to
actual outputting for converting the
assembled instructions into the format
needed by the loader.
10. An output deck of assembled instructions
in the format needed by the loader.
Format of Data Bases
Format of Data Bases
Machine-Op Table (MOT) for pass 1 and pass 2
Format of Data Bases
Pseudo-Op Table (POT OR OPTAB) for pass1 and pass 2
Format of Data Bases
Symbol Table (ST OR SYMTAB) for pass 1 and pass 2
Pass 1
Pass 2
Look for ModularitySome functions that may be isolated in Pass 1:
Look for modularitySome functions that may be isolated in pass 2
1. READ22. POTGET23. MOTGET24. EVAL5. PUNCH6. PRINT7. DCGEN8. DLENGTH9. BTSTO10. BTDROP11. BTGET12. LTGEN