Open the
object file,
SET offset = 0,
SET LC = 0
Read next line
START
EOF
END
Close Object File
Update section table
and location counter
Update symbol table
to mark global
symbols
Any symbol defined
E Raise Error
E
Parse line into label,
mnemonic and
operands
Type of
mnemonic
Label Present
Machine Instruction
Pseudo Opcode
Label found in
Symbol table
but with type
undefined
Yes
Backpatch locations in
forward reference
table for this label
Update Symbol Table
to set the entries
correctly
Insert label and LC
into Symbol Table
Operand present in
Symbol
Table
Yes
No
Make an entry in
Symbol Table with
type undefined
No
Undefined
Type?
Yes
Make an entry in
forward reference list
Yes
Generate code, write
into object file and
update location
counter
No
A
A
is Pseudo
opcode?
No
Valid
datatype?
Yes
E
No
Yes
Extern ? Global ? Section ? Common ?
No No No
Insert into Symbol
Table marking type as
external
Insert into global list
Yes Yes
First section
Yes
Insert into common
table and also in
Symbol table marking
type as common
Mark size section of
last section in section
table to be LC
Create new entry in
section table and
update LC
A
Yes
No
Yes
Pritthijit Nath
Single Pass Assembler
Yes
No
Assembler Directive

Single-Pass-Assembler-flow diagram .pdf

  • 1.
    Open the object file, SEToffset = 0, SET LC = 0 Read next line START EOF END Close Object File Update section table and location counter Update symbol table to mark global symbols Any symbol defined E Raise Error E Parse line into label, mnemonic and operands Type of mnemonic Label Present Machine Instruction Pseudo Opcode Label found in Symbol table but with type undefined Yes Backpatch locations in forward reference table for this label Update Symbol Table to set the entries correctly Insert label and LC into Symbol Table Operand present in Symbol Table Yes No Make an entry in Symbol Table with type undefined No Undefined Type? Yes Make an entry in forward reference list Yes Generate code, write into object file and update location counter No A A is Pseudo opcode? No Valid datatype? Yes E No Yes Extern ? Global ? Section ? Common ? No No No Insert into Symbol Table marking type as external Insert into global list Yes Yes First section Yes Insert into common table and also in Symbol table marking type as common Mark size section of last section in section table to be LC Create new entry in section table and update LC A Yes No Yes Pritthijit Nath Single Pass Assembler Yes No Assembler Directive