1st pass of a 2 pass assembler.
Initialize Instruction Location Counter (ILC), symbol table and misc.
Read source code line
While not END statement
Do
If line is not comment then
More than 1 of the following actions may occur for each line.
If line defines a location by a symbol then
Note symbolic labels
- enter symbol and location counter or value ( EQU statement).
Endif
If line contains a literal (pseudo-immediate) then
Store literal in a table
Endif
Get instruction from line
If pseudo-instruction then
Act on pseudo-instruction
Pseudo-instructions
Defining macros.
Conditional compiling.
Endif
If ISA instruction
Determine instruction type and length
- reconize scope, near memory, far memory, effective address
Note relocatable and external memory references
- save in a table.
Endif
Preserve information about instruction (in file).
- type, opcode, length, copy of line.
Increment ILC
Endif
Read next line in source code
Endwhile
Note entry point to program indicated by END
Sort literal table and remove duplicates.