Skip to content

An assembler that converts dlx-format instructions to 32-bit binaries

Notifications You must be signed in to change notification settings

Ehiremen/dlx-assembler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dlx-assembler

an assembler that converts dlx-format instructions to 32-bit binaries. done using C++ and compiled on JetBrains CLion.
the program reads a dlx-format instruction file and converts each line to its equivalent assembly language format. the assembly instructions get written to a file (instr.txt)--this can be changed in "void convertAndWriteInstr(vector vecOfCodeLine, vector vecOfLabelsAdr)" ~line 546.

my approach:

  • read the input file (specified by the user in string getFileName())
  • convert to lowercase and store in a new file (lower.txt)
  • remove commas, colons, and parentheses from the lower.txt file, and store in a new tokenated file (tk.txt)
  • read the first word of each instruction and check if that word is in either Opcode OR ALUFunc map; if not, we identify it as a label
  • finally, run void convertAndWriteInstr(vector vecOfCodeLine, vector vecOfLabelsAdr) to generate the binaries for each instruction

NOTE: dlx_assembler.cpp is fairly large (~600 lines), but everything called in main() is either a defined class or a defined function so this code can readily be divided into multiple source files

files included:

About

An assembler that converts dlx-format instructions to 32-bit binaries

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published