One Pass Assembler
One Pass Assembler
LOCCTR = 0;
while OPCODE != END do
;; or EOF
begin
read a line from the code
if there is a label
if this label is in SYMTAB, then error
else insert (label, LOCCTR) into SYMTAB
search OPTAB for the op code
if found
LOCCTR += N
;; N is the length of
this instruction (4 for MIPS)
else if this is an assembly directive
update LOCCTR as directed
else error
write line to intermediate file
end
program size = LOCCTR - starting address;
end
Load-and-go assembler
Load-and-go assembler generates their object code in memory for immediate execut
ion.
No object program is written out, no loader is needed.
It is useful in a system oriented toward program development and testing such th
at the efficiency of the assembly process is an important consideration
Forward Reference:
Load-and-go assembler
Omits the operand address if the symbol has not yet been defined
Enters this undefined symbol into SYMTAB and indicates that it is undefined
Adds the address of this operand address to a list of forward references associa
ted with the SYMTAB entry
Scans the reference list and inserts the address when the definition for the sym
bol is encountered.
Reports the error if there are still SYMTAB entries indicated undefined symbols
at the end of the program
Search SYMTAB for the symbol named in the END statement and jumps to this locati
on to begin execution if there is no error