This project is a C++ program that converts assembly-like instructions (e.g., ADD, STA, INP) into binary machine code based on a custom instruction set architecture. It reads instructions from input.txt and writes the converted binary codes to output.txt.
- Supports multiple instruction sets and operand types
- Handles direct and indirect addressing
- Skips comments in the input
- Outputs both the original instruction and its binary representation
- Make sure you have a C++ compiler (e.g., g++, clang++) installed.
- Compile the program:
On Windows, you can use MinGW or Visual Studio's compiler.
g++ converter.cpp -o converter
- Place your instructions in
input.txt(see example below). - Run the program:
or on Windows:
./converter
converter.exe
- The output will be written to
output.txt.
- Each line contains an instruction, optional operand, and optional comment (starting with
//). - Example:
ORG 20A BSA 103 //comment1 INP ADD K ADD y ISZ x //comment2 STA z ISZ 515 I ISZ 103 AND 155 I //comment3 BUN FAE I HLT //comment4 x 053 //comment5 y FE9 z AA0 FAFA //comment6 FAFA
- Each line contains the memory address, instruction, operand, and the binary code (16 bits).
- Example output:
20A : BSA 103 0000000100000011 ...
This project is open source. See the original repository for details.