Software model of an educational microcomputer with an educational assembly language
A comprehensive educational tool for learning assembly language programming, featuring a complete development environment with assembler, emulator, and visual debugging capabilities.
ASM Emulator is an educational microcomputer simulation designed to help students and enthusiasts learn assembly language programming concepts. The project provides a complete development environment including:
- Assembly Code Editor with syntax highlighting
- Assembler that translates assembly code to machine code
- Machine Emulator that executes the compiled programs step-by-step
- Visual Debugger showing processor state, memory contents, and registers
- Real-time Execution with status monitoring
- ๐ Rich Text Editor with assembly syntax highlighting and line numbers
- ๐ง Two-Pass Assembler with comprehensive error reporting and diagnostics
- ๐ฅ๏ธ 8-bit Microprocessor Emulator with realistic instruction execution
- ๐งฎ Arithmetic Logic Unit (ALU) with flag support (Zero, Minus, Overflow, Carry)
- ๐พ 256-byte RAM with hexadecimal and binary visualization
- ๐ Register Monitoring showing processor state in real-time
- ๐ Step-by-step Debugging capabilities
- ๐ Listing Generation showing assembled code with addresses
- ๐ข Binary Output display for understanding machine code
The emulated processor supports the following instruction types:
ADD
- Add register to accumulatorAND
- Bitwise AND operationOR
- Bitwise OR operation
LDRC
- Load constant into registerLDRB
- Load byte from memory into registerSVRB
- Store register byte to memory
JMP
- Unconditional jumpJMPI
- Indirect jumpJZ/JNZ
- Jump if zero/not zeroJM/JNM
- Jump if minus/not minusJOV/JNOV
- Jump if overflow/not overflowJC/JNC
- Jump if carry/not carry
ORG
- Set origin addressDATA
- Define data bytesEND
- End of program
- 4 General Purpose Registers: R0, R1, R2, R3 (also accessible as A, B, C, D)
- Program Counter (PC): Tracks current instruction address
- Status Flags: Zero (Z), Minus (M), Overflow (OV), Carry (C)
asm_emulator/
โโโ asm_gui/ # JavaFX GUI Application
โ โโโ src/sample/
โ โ โโโ Controller.java # Main GUI controller
โ โ โโโ EditorColoring.java # Syntax highlighting
โ โ โโโ EmulatorData.java # Data model for emulator state
โ โ โโโ FileProcessing.java # File I/O operations
โ โ โโโ Main.java # Application entry point
โ โโโ libs/ # External dependencies
โโโ micro_comp_console_syntax/ # Assembler Module
โ โโโ src/com/company/
โ โโโ Asm.java # Main assembler class
โ โโโ SourceLine.java # Source code parsing
โ โโโ DiagLine.java # Error diagnostics
โ โโโ ListingLine.java # Assembly listing generation
โโโ micro_comp_console_machine_emulator/ # Machine Emulator Module
โ โโโ src/com/company/
โ โโโ Proc.java # Processor simulation
โ โโโ ALU.java # Arithmetic Logic Unit
โ โโโ RAM.java # Memory simulation
โโโ libs/ # Shared libraries
โโโ commons-lang3-3.9.jar
โโโ richtextfx-fat-0.10.1.jar
- Java 8 or higher with JavaFX support
- IntelliJ IDEA (recommended) or any Java IDE
- The following libraries are included in the
libs/
directory:- RichTextFX 0.10.1 (for the code editor)
- Apache Commons Lang 3.9
-
Clone the repository:
git clone https://github.com/nayutalienx/asm_emulator.git cd asm_emulator
-
Open in IntelliJ IDEA:
- Open the
asm_gui
project folder - Ensure the libraries in
libs/
are added to the classpath - The project should auto-configure with the included
.iml
files
- Open the
-
Run the application:
- Execute the
Main.java
class inasm_gui/src/sample/
- The GUI application will launch
- Execute the
Each module can be compiled separately:
-
Compile the assembler:
cd micro_comp_console_syntax javac -d out src/com/company/*.java
-
Compile the emulator:
cd micro_comp_console_machine_emulator javac -d out src/com/company/*.java
-
Compile the GUI (with dependencies):
cd asm_gui javac -cp "libs/*" -d out src/sample/*.java
- Start the application and use the code editor on the left panel
- Write your assembly code using the supported instruction set
- Click "Translate" or enable auto-translation to compile your code
- View the listing in the middle panel showing addresses and machine code
- See binary output in the right panel
ORG 1H ; Start at address 1H
LDRB a,30H ; Load byte from address 30H into register A
LDRB b,32H ; Load byte from address 32H into register B
ADD a,b ; Add B to A, result in A
SVRB a,34H ; Store result to address 34H
END ; End program
ORG 30H ; Data section at 30H
DATA 25H ; First operand = 37 decimal
DATA 0FAH ; Second operand = 250 decimal
DATA 0 ; Result storage
- Load the compiled program into memory using "Load to Memory"
- Click "Run" to execute the entire program at once
- Use "Step" for step-by-step debugging
- Monitor the processor state in the bottom panel
- View memory contents and register values in real-time
- Memory Viewer: Shows RAM contents in hex, binary, and decimal
- Register Display: Current values of all registers and flags
- Status Log: Real-time execution status and processor operations
- Step Execution: Execute one instruction at a time
- Breakpoint Support: Pause execution at specific points
This emulator is designed for:
- Computer Science Education: Teaching processor architecture and assembly language concepts
- Digital Logic Courses: Demonstrating CPU operation and instruction execution
- Systems Programming: Understanding low-level programming concepts
- Self-Study: Learning assembly language in a visual, interactive environment
- 8-bit data width with 8-bit addresses (256 bytes of memory)
- Harvard architecture (separate instruction and data paths)
- 4 general-purpose registers with accumulator-based operations
- Condition code flags for program flow control
- 256 bytes of RAM (addresses 00H to FFH)
- Byte-addressable memory organization
- Little-endian byte ordering for multi-byte data
- Case-insensitive instruction mnemonics
- Hexadecimal constants with 'H' suffix (e.g.,
0AH
,FFH
) - Register names: R0-R3 or A, B, C, D
- Comments start with semicolon (
;
) - Labels supported for jump targets
This is an educational project. Contributions that enhance the learning experience are welcome:
- Bug fixes and improvements
- Additional instruction set features
- Enhanced debugging capabilities
- Documentation improvements
- Example programs and tutorials
This project is intended for educational use. Please check with the original authors for specific licensing terms.
Original Russian description: "ะัะพะณัะฐะผะผะฝะฐั ะผะพะดะตะปั ััะตะฑะฝะพะน ะผะธะบัะพัะฒะผ ั ััะตะฑะฝัะผ ัะทัะบะพะผ ะฐััะตะผะฑะปะตัะฐ"