Skip to content

Galamrani/Small-Assembler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Small Assembler

This project is a small version of an assembler, written in C. It translates simplified assembly language instructions into machine code. It was created as a learning exercise to understand the basics of assembly language and how assemblers work.

About the Program

Designed as a project for a programming lab class at the university, this application allows users to input low-level assembly language instructions and receive corresponding machine code as output. By mimicking the behavior of an assembler, this project aims to provide a hands-on learning experience for understanding the translation process from assembly language to machine code.

For a better understanding of the program, use this link: Instructions for the project.

Features

  • Translates simplified assembly language instructions into machine code.
  • Supports a limited set of assembly instructions.
  • Provides a simple command-line interface for input and output.

How the Program Works

The program is divided into two transitions, each of them taking care of different parts of the program workflow.

The First Transition

  1. Check for errors in the input file and, if necessary, create an error file with information about the error. If an error occurs, the second transition will not execute.
  2. Build a symbol table. The symbol table's main goal is to store information about labels in the input file, like addresses, values, etc. This information will help us in the second transition.

The Second Transition

  1. Build the code segment and data segments using the symbol table and the input file commands.

    • The code segment's goal is to store the binary code for each command that is identified as a code command.
    • The data segment's goal is to store the binary code for each command that is identified as a data command.
  2. Build the output files using the data segment, code segment, and symbol table.

    • There are 3 output files:
      • ps.ob (machine code file) file that contains the binary code of the input file as hexadecimal code.
      • ps.ent (entry file) file that contains all the entry labels and their address.
      • ps.ext (external file) file that contains all the external labels and their address.

About

Console app written in C that mimics an assembler, this is a project from a programming lab class, at the university.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages