This is an assembler written in Python.
Design an assembler that converts assembly code to machine code. This assembler project supports instructions like ADD, AND, SUB, OR, and JMP.
In this part, a short JMP instruction is added. Additionally, support is extended to handle the last parts (MOD = 11) and (MOD = 00).
- We don't support 16 bits in MOD = 00!
- For ah, ch, esp, and ebp, we consider them the same as other registers (No SIB).
- Only one jump is allowed.
A great thanks to Mr. Mirhosseini for his awesome guidance during the development of this assembler.
- Ensure you have Python installed on your machine.
- Clone this repository to your local system.
- Create an input text file named
InputsAsmCodes.txt
and add your assembly code to it. - Run the assembler using the command:
python assembler.py
. - The assembler will read the input file, process the instructions, and generate the corresponding machine code.
- The output will be displayed in the console.
; Example Assembly Code
ADD AX, BX
SUB CX, DX
AND AX, 0x0F
OR BH, AL
JMP LABEL
LABEL:
; Your code here