Repository navigation
Interactive Mode - 16-bit Mini-Architecture Assembler
Description
The interactive mode allows you to use the assembler without creating .asm files in advance. It provides a dynamic prompt where the user types instructions for the 16-bit mini-architecture and immediately receives feedback on the assembled machine code.
This mode is ideal for quick tests, learning, and debugging simple programs without relying on external files.
How to start interactive mode
Run the assembler with the -i or --interactive flag:
./assembler -i
or
./assembler --interactive
Upon starting, the terminal is cleared and a welcome message is displayed along with the instruction guide.
Features
-
Interactive prompt
- Each line entered corresponds to an instruction to assemble.
- The prompt shows the current program memory address, e.g.,
[00]> LDA R0, 5
-
Instruction guide
- Type
help(orajuda) to display all instructions and their formats. - Type
end(orfim) to finish input and generate the final machine code.
- Type
-
Instruction validation
- Validates registers (R0 to R7)
- Validates immediate values or addresses within the limit (0-15)
- Checks the correct number of operands
- Displays detailed error messages if an instruction is invalid.
-
Machine code visualization
- When input ends, the program shows:
- Address
- Hexadecimal code
- Binary code formatted as
Op Rd Rf1 Rf2 Imm
- When input ends, the program shows:
-
File saving
- Users can save the assembled machine code to a Logisim-compatible file.
- Example file format:
v2.0 raw 0000 1005 2107 ...
Notes
- Maximum number of instructions in interactive mode: 16
- Useful for quick tests and learning
- For larger programs or production use, it is recommended to use
.asmfiles with the-cand-oflags
Documentation generated by ChatGPT (Ely Neto)
Full Changelog: v1.0...v1.1