Page 73 - DCAP507_SYSTEM_SOFTWARE
P. 73
Unit 4: Design of Assembler
The SKS and NUM/CHC pseudo-ops are processed essentially as in pass 1. In pass 2, though, Notes
actual code must be produced for the NUM/CHC pseudo-op. Based upon the data types specified,
this includes diverse conversions (e.g., floating point character to binary representation) and
symbol evaluations (e.g., address constants). The END pseudo-op signifies the end of the source
program and finishes the assembly. Different "housekeeping" tasks must now be performed."
For example, code must be produced for any literals remaining in the Literal Table.
Pass 2
Read improved source file
if instruction
==> yes==> instruction
use op-code (binary) saved from pass 1
Begin building binary version of the instruction
Add r & X field binary
Transform to hex
Search S symbol in symbol/literal table
Append hex address to end of instruction
Find out A/R/E...then add A/R/E to end of hex op-code
Append symbol if E
Write valid machine code instruction
==> no==> pseudo-op
Define hex equivalent for CHR, NUM and ADR
Write valid hex to object file
Process other pass 2 formatting pseudo ops
END
Finish object file
Finish output
Print symbol table
4.1.6 Look for Modularity
We now evaluate our design, searching functions that can be isolated. Usually, such functions
fall into two categories: (1) multi-use and (2) unique. Listed below are some of the functions that
may be isolated in the two passes. Observe a common table building/searching, hex integer bit
conversions.
Pass 1
1. READ1 Read the next assembly source card.
2. POT_TABLE Search the pass 1 Pseudo-Op Table (POT) for a match with the operation
field of the current source card.
LOVELY PROFESSIONAL UNIVERSITY 67