Skip to content

It generates object code, table of variables for Assembler code, built with c++

License

Notifications You must be signed in to change notification settings

muhammedkamal97/Assembler

 
 

Repository files navigation

Assembler

the project consist of 2 pases :

pass 1 :

  • Specifications:

    1. Parsing SIC/XE code in formatts 2,3 & 4.
    2. Handling directives BYTE,WORD,RESW,RESB,ORG & EQU.
    3. Generate the symbol table.
    4. Generate the source file of code with assigned addresses.
  • Design :

    The main design consist of 4 modules parsing ,validation, executing the pass1 algorithm & printing the output.
    • The parsing module extract the components of each line.
    • The validating module validate the components of every line.
    • Then executing the algorithm and printing the output.
  • Main data structures :

    • Arrays & Lists : contain the components of every line sequenchelly.
    • Maps : made one to one mapping between the operation code & their hexadecimal values & formats
    • Created data structures LIne & Rows : carry the values of the line components.
  • Algorithm :

- Assumptions : - Add comments in free format preceded with “.” - Don’t enter literals & expressions.
  • Sample runs :

pass 2 :

  • Specifications:

    • The assembler is to execute by entering assemble .
    • The source file for the main program for this phase is to be named assemble.cpp.
    • The output of the assembler should include (at least):
      • Object-code file whose format is the same as the one described in the text book in section 2.1.1 and 2.3.5.
      • A report at the end of pass2. Pass1 and Pass2 errors should be included as part of the assembler report, exhibiting both the offending line ofsource code and the error.
    • The assembler should support:
      • EQU and ORG statements.
      • Simple expression evaluation. A simple expression includes simple {A -op- B} operand arithmetic, where -op- is one of +,-,*,/ and no spaces surround the operation, eg. A+B.
      • Literals (Including LTORG) =C’’, =X’HEX-TEXT’, = forms
  • Design :

    The main design consist of 5 main modules parsing ,validation, executing the pass1 algorithm, executing pass 2 algorithm & printing the output
    • The parsing module extract the components of each line.
    • The validating module validate the components of every line.
    • The pass2 module generate the object code for each line and print it in a file.
    • Then executing the algorithm and printing the output.
  • Main data structures :

    • Arrays & Lists & vectors : contain the components of every line sequenchelly.
    • Maps : made one to one mapping between the operation code & their hexadecimal values & formats.
    • Created data structures LIne & Rows : carry the values of the line components.
  • Algorithm :

  • Sample runs :

a detaield Explanation can be found here Report 1 , Report 2

Running

Clone & install

  • Clone this repo https://github.com/Magho/Assembler
  • cd Assemblerp
  • run assembler.exe file

Authors

License

License LICENSE.md

About

It generates object code, table of variables for Assembler code, built with c++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • C++ 65.9%
  • Makefile 15.0%
  • CMake 10.2%
  • C 8.9%