This repository contains a 2-pass assembler implemented in C++ for a simple instruction set architecture (ISA) of an accumulator-based machine, along with an emulator to execute the assembled object code.
This project serves as a CS210 course (assembly language programming and computer architecture) project under Prof. Jimson Matthew. The aim is to design and implement a 2-pass assembler capable of translating assembly language programs written for a simple accumulator-based machine into machine code, and subsequently, an emulator to execute the generated machine code.
-
2-Pass Assembler: The assembler processes assembly language programs in two passes, handling symbol resolution, generating machine code, and producing an object file and listing file.
-
Emulator: The emulator executes the assembled object code, simulating the behavior of the target accumulator-based machine.
-
Simple Instruction Set: The instruction set of the target machine is intentionally kept simple to facilitate understanding and implementation. See Instruction set in project description pdf.
-
Clone the repository:
git clone https://github.com/your-username/2-pass-assembler.git
-
Navigate to the project directory:
cd 2-pass-assembler
-
Complie & Run the assembler:
running scripts are given in Makefile.txt
The assembler consists of two passes:
-
Pass 1: In the first pass, the assembler scans the assembly code, building a symbol table and resolving symbolic addresses.
-
Pass 2: In the second pass, the assembler generates machine code based on the resolved addresses and produces the object code and listing file.
The emulator reads the object code generated by the assembler and simulates the behavior of the target accumulator-based machine. It executes each instruction sequentially, updating the accumulator and other relevant registers as necessary. Outputs a memory dump.
Contributions are welcome! If you find any bugs or have suggestions for improvements, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.