Page 72 - DCAP507_SYSTEM_SOFTWARE
P. 72
System Software
Notes In-between Passes
sort symbol table
save intermediate source file
Construct general object file information
Pass 2: Generate Code
After all the symbols have been depicted by pass 1, it is probable to terminate the assembly by
processing each record and determining values for its operation code and its operand field.
Additionally, pass 2 must structure the generated code into the suitable format for later processing
by the loader, and print an assembly listing comprising the original source and the hexadecimal
equivalent of the bytes produced. A record is read from the source file left by pass 1. The
operation code field is scrutinized to find out if it is a pseudo-op; if it is not, the table of machine
op codes (MOT) is hunted to discover a match for the op-code field.
The matching MOT entry indicates the length, binary op-code, and the format type of the
instruction.
Did u know? The operand fields of the different instruction format types need somewhat
different processing.
For the RR-format instructions, each of the two register specification fields is evaluated. This
evaluation may be very straightforward, as in:
AR 2,3 [RR Format]
MPY 1,EVEN [RX format]
MPY 1,EVEN(3) [RX format]
or more complex, as in:
MPY l,EVEN+EVEN+I
MOVE MUD, DIRT [SSI format]
MOVE MUD(3),DIRT [SSI format]
The two fields are inserted into their individual fields in the RR-instruction. For RX format
instructions, the register and index fields are assessed and processed in the similar manner as the
register specifications for RR-format instructions. The storage address operand is evaluated to
produce an Effective Address EA). Only the RR and RX instruction types are overtly displayed in
the flowchart. The other instruction formats are managed similarly. After the instruction has
been assembled, it is put into the essential format for later processing by the loader. Usually,
numerous instructions are placed on a single record. A listing line containing a replica of the
source card, its allocated storage location, and its hexadecimal representation is then printed.
Lastly, the location counter is incremented and processing is continued with the next record. As
in pass 1, each of the pseudo-ops calls for special processing.
Notes The EQU pseudo-op needs very little processing in pass 2, since symbol definition
was completed in pass 1. It is essential only to print the EQU record as part of the printed
listing.
66 LOVELY PROFESSIONAL UNIVERSITY