Algorithm for RISC Assembler: Begin - Systems Software | COP 3402, Study notes of Computer Science

Material Type: Notes; Class: Systems Software; Subject: Computer Programming; University: University of Central Florida; Term: Spring 2001;

Typology: Study notes

Pre 2010

Uploaded on 02/25/2010

koofers-user-5g4-1
koofers-user-5g4-1 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Pass 2 algorithm for RISC assembler:
begin
initialize opcode table
open intermediate file and symbol table file
load symbol table from file and close symbol table file
open output object file and output listing file
write object file header
read input line from intermediate file
do
if (line != ".EXTERN") && (line != ".CODE") && (line != ".END")
echo line to listing file
read input line from intermediate file
elseif (line == ".EXTERN")
echo .EXTERN line to listing file
read input line from intermediate file
while (line != ".DATA") && (line != ".CODE") && (line != ".END")
echo line to listing file
add subroutine name, library name to external reference list
read input line from intermediate file
endwhile
elseif (line == ".CODE")
echo .CODE line to listing file
read input line from intermediate file
while (line != ".DATA") && (line != ".EXTERN") && (line != ".END")
calculate object code for instruction
echo line to listing file, adding object code
write object code to object file
read input line from intermediate file
endwhile
endif
while (line != ".END")
echo .END line to listing file
close intermediate file
close output listing file
write beginning of object file trailer
while (not at end of external reference list)
write external reference information to object file trailer
endwhile
close output object file
end

Partial preview of the text

Download Algorithm for RISC Assembler: Begin - Systems Software | COP 3402 and more Study notes Computer Science in PDF only on Docsity!

Pass 2 algorithm for RISC assembler:

begin initialize opcode table open intermediate file and symbol table file load symbol table from file and close symbol table file open output object file and output listing file write object file header read input line from intermediate file do if (line != ".EXTERN") && (line != ".CODE") && (line != ".END") echo line to listing file read input line from intermediate file elseif (line == ".EXTERN") echo .EXTERN line to listing file read input line from intermediate file while (line != ".DATA") && (line != ".CODE") && (line != ".END") echo line to listing file add subroutine name, library name to external reference list read input line from intermediate file endwhile elseif (line == ".CODE") echo .CODE line to listing file read input line from intermediate file while (line != ".DATA") && (line != ".EXTERN") && (line != ".END") calculate object code for instruction echo line to listing file, adding object code write object code to object file read input line from intermediate file endwhile endif while (line != ".END") echo .END line to listing file close intermediate file close output listing file write beginning of object file trailer while (not at end of external reference list) write external reference information to object file trailer endwhile close output object file end