Skip to content

het004/8051_Assembler-GUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

22 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation


๐Ÿ”ง 8051 Microcontroller Assembler & Simulator

Python Streamlit Assembly Microcontroller Education License

๐Ÿš€ Interactive web-based 8051 microcontroller assembler and simulator for educational and development purposes

๐Ÿ”ง Features โ€ข ๐Ÿ“– Installation โ€ข ๐ŸŽฎ Usage โ€ข ๐Ÿ—๏ธ Architecture


๐ŸŽฏ What This Project Accomplishes

Transform embedded systems education with an interactive 8051 simulator! This comprehensive tool revolutionizes how students and engineers learn microcontroller programming by:

  • ๐Ÿ”ง Real-time Assembly Compilation - Write and compile 8051 assembly code instantly
  • ๐Ÿ“Š Live Register Monitoring - Visualize register and flag changes in real-time
  • ๐ŸŽ“ Educational Focus - Perfect for learning embedded systems programming
  • ๐ŸŒ Web-based Interface - No installation of complex IDEs required
  • ๐Ÿ” Error Detection - Comprehensive syntax and semantic error checking

โœจ Key Features

๐Ÿง  Advanced 8051 Instruction Support

  • ๐Ÿ“ฆ Data Transfer: MOV operations with registers and immediate values
  • โž• Arithmetic Operations: ADD, SUBB, INC, DEC with flag updates
  • ๐Ÿ”— Logical Operations: ANL, ORL, XRL, CPL for bit manipulation
  • ๐Ÿ”„ Bit Manipulation: RL, RR, RLC, RRC, SWAP for data rotation
  • ๐ŸŽฏ Register Support: Complete A, R0-R7, DPTR register set

๐Ÿ“Š Real-time Visualization

  • ๐Ÿ“ˆ Live Register Display: Monitor accumulator and working registers
  • ๐Ÿšฉ Flag Status Monitoring: Track Carry (CY), Auxiliary Carry (AC), Overflow (OV), Parity (P)
  • ๐Ÿ“‹ Program Status Word: Real-time PSW register visualization
  • ๐Ÿ” Step-by-step Execution: Watch how instructions affect system state

๐ŸŽจ Professional User Interface

  • โœจ Syntax Highlighting: Assembly code editor with 8051-specific highlighting
  • ๐ŸŒ™ Dark Theme: Modern Monokai theme for comfortable coding
  • ๐Ÿ“ฑ Responsive Design: Works seamlessly on desktop and tablet devices
  • โšก Real-time Compilation: Instant feedback on code changes

๐Ÿ—๏ธ System Architecture

graph TD
    A[๐Ÿ“ Code Editor] --> B[๐Ÿ“‹ Parser Module]
    B --> C[๐Ÿ” Syntax Validation]
    C --> D[โš™๏ธ Instruction Execution]
    D --> E[๐Ÿ“Š Register Updates]
    D --> F[๐Ÿšฉ Flag Updates]
    E --> G[๐Ÿ“ˆ Display Tables]
    F --> G
    
    style A fill:#ff6b6b
    style D fill:#4ecdc4
    style G fill:#45b7d1
Loading

๐Ÿš€ Quick Start Installation

Prerequisites

  • Python 3.8+
  • Modern web browser
  • Basic understanding of assembly language

1. Clone & Setup

# Clone the repository
git clone https://github.com/het004/8051_Assembler-GUI.git
cd 8051_Assembler-GUI

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

2. Launch the Application

streamlit run main.py

3. Access the Simulator

Open your browser and navigate to: http://localhost:8501


๐ŸŽฎ Usage Examples

๐Ÿ“ Basic Arithmetic Example

MOV A, #4F      ; Load 4F hex into accumulator
SUBB A, #10     ; Subtract 10 hex from A
ANL A, #0FH     ; AND with 0F hex
CPL A           ; Complement accumulator

Expected Output:

  • A Register: 4FH โ†’ 3FH โ†’ 0FH โ†’ F0H
  • Flags: Carry, Overflow, and Parity flags updated accordingly

๐Ÿ”„ Bit Manipulation Example

MOV A, #0AA     ; Load pattern 10101010
RL A            ; Rotate left
RRC A           ; Rotate right through carry
SWAP A          ; Swap nibbles

๐Ÿ“Š Register Operations Example

MOV R0, #10     ; Load 10 into R0
MOV R1, #20     ; Load 20 into R1
MOV A, R0       ; Transfer R0 to A
ADD A, R1       ; Add R1 to A

๐Ÿ› ๏ธ Supported Instructions

Category Instructions Description
๐Ÿ“ฆ Data Transfer MOV A, #data Move immediate data to accumulator
MOV A, Rn Move register to accumulator
MOV Rn, #data Move immediate data to register
โž• Arithmetic ADD A, #data Add immediate data to A
SUBB A, #data Subtract with borrow from A
INC A/Rn Increment accumulator/register
DEC A/Rn Decrement accumulator/register
๐Ÿ”— Logical ANL A, #data Logical AND with A
ORL A, #data Logical OR with A
XRL A, #data Logical XOR with A
CPL A Complement accumulator
๐Ÿ”„ Rotation RL A Rotate A left
RR A Rotate A right
RLC A Rotate A left through carry
RRC A Rotate A right through carry
SWAP A Swap nibbles in A

๐Ÿ“ Project Structure

๐Ÿ”ง 8051_Assembler-GUI/
โ”œโ”€โ”€ ๐Ÿš€ main.py                      # Application entry point
โ”œโ”€โ”€ ๐ŸŽจ assembler_gui.py             # Streamlit UI implementation
โ”œโ”€โ”€ ๐Ÿ“‹ parser.py                    # Assembly code parser
โ”œโ”€โ”€ โš™๏ธ executor.py                  # Instruction execution engine
โ”œโ”€โ”€ ๐Ÿ“Š state.py                     # Register and flag definitions
โ”œโ”€โ”€ ๐Ÿšฉ flags.py                     # Flag update logic
โ”œโ”€โ”€ ๐Ÿ› ๏ธ utils.py                     # Utility functions
โ”œโ”€โ”€ ๐Ÿ“ฆ requirements.txt             # Project dependencies
โ”œโ”€โ”€ ๐Ÿ“ Instructions/                # Instruction implementations
โ”‚   โ”œโ”€โ”€ ๐Ÿงฎ arithmetic.py           # Arithmetic operations
โ”‚   โ”œโ”€โ”€ ๐Ÿ”— logic.py                # Logical operations
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ฆ data_transfer.py        # Data transfer operations
โ”‚   โ”œโ”€โ”€ ๐Ÿ”„ shift_rotate.py         # Bit manipulation operations
โ”‚   โ””โ”€โ”€ ๐ŸŽฏ control_flow.py         # Control flow operations (future)
โ””โ”€โ”€ ๐Ÿ“– README.md                   # Project documentation

๐ŸŽฏ Use Cases & Applications

๐ŸŽ“ Educational Institutions

  • Microcontroller Courses: Interactive learning tool for embedded systems
  • Laboratory Sessions: Hands-on programming without hardware requirements
  • Assignment Grading: Quick verification of student assembly programs
  • Concept Demonstration: Visual representation of instruction execution

๐Ÿ‘จโ€๐Ÿ’ป Professional Development

  • Algorithm Testing: Quick prototyping of embedded algorithms
  • Code Verification: Testing assembly routines before hardware implementation
  • Training Programs: Corporate embedded systems training
  • Interview Preparation: Practice assembly programming concepts

๐Ÿ”ฌ Research & Development

  • Algorithm Development: Research new embedded processing techniques
  • Academic Papers: Generate examples and demonstrations
  • Proof of Concepts: Validate theoretical concepts practically
  • Student Projects: Final year and graduate project development

๐ŸŒŸ Technical Specifications

Aspect Details
๐ŸŽฏ Target Architecture Intel 8051 Microcontroller
๐Ÿ“ Supported Formats Hexadecimal (#4FH), Decimal (#79), Binary
๐Ÿ“Š Register Coverage A, R0-R7, DPTR, PSW
๐Ÿšฉ Flag Support CY, AC, OV, P flags
๐Ÿ”ง Instruction Count 20+ core instructions
โšก Performance Real-time execution simulation

๐Ÿ”ฎ Future Enhancements

๐Ÿšง Planned Features

  • ๐ŸŽฏ Complete Instruction Set - Support all 255 8051 instructions
  • ๐Ÿ—‚๏ธ Memory Visualization - Internal and external RAM display
  • โฐ Timer/Counter Simulation - Complete peripheral simulation
  • ๐Ÿ“ฑ Mobile App - React Native mobile application
  • ๐Ÿ”Œ Hardware Integration - Connect to real 8051 development boards
  • ๐Ÿ“Š Code Analysis - Performance metrics and optimization suggestions

๐ŸŽจ UI/UX Improvements

  • ๐ŸŽจ Multiple Themes - Light/dark theme options
  • ๐Ÿ’พ Project Management - Save and load assembly projects
  • ๐Ÿ” Advanced Debugger - Breakpoints and step-through debugging
  • ๐Ÿ“ˆ Execution Statistics - Instruction count and timing analysis

๐Ÿ“š Learning Resources

๐Ÿ“– 8051 Microcontroller Basics

The 8051 microcontroller, developed by Intel in 1980, features:

  • 8-bit CPU with Harvard architecture
  • 4KB ROM and 128 bytes RAM on-chip
  • 32 I/O pins for interfacing
  • 2 Timer/Counters for timing operations
  • 5 Interrupt sources for real-time processing

๐ŸŽฏ Programming Tips

  1. Register Optimization: Use working registers (R0-R7) for temporary storage
  2. Flag Awareness: Monitor carry and overflow flags for arithmetic operations
  3. Addressing Modes: Understand immediate, register, and direct addressing
  4. Memory Management: Efficiently use internal RAM space

๐Ÿค Contributing

We welcome contributions from embedded systems enthusiasts and educators!

๐Ÿ› ๏ธ How to Contribute

  1. ๐Ÿด Fork the repository
  2. ๐ŸŒฟ Create your feature branch (git checkout -b feature/NewInstruction)
  3. ๐Ÿ”ง Add new instructions or features
  4. ๐Ÿ’พ Commit your changes (git commit -m 'Add SFR support')
  5. ๐Ÿ“ค Push to the branch (git push origin feature/NewInstruction)
  6. ๐ŸŽฏ Open a Pull Request

๐ŸŽฏ Contribution Areas

  • ๐Ÿ“ New Instructions: Implement additional 8051 instructions
  • ๐ŸŽจ UI Improvements: Enhance user interface and experience
  • ๐Ÿ”ง Bug Fixes: Resolve issues and improve stability
  • ๐Ÿ“– Documentation: Improve guides and examples
  • ๐Ÿงช Test Cases: Add comprehensive test coverage

๐Ÿ› Troubleshooting

๐Ÿ”ง Common Issues & Solutions

Q: "ModuleNotFoundError: No module named 'state'"

# Ensure you're in the correct directory and state.py exists
ls -la state.py
python main.py

Q: Invalid instruction error

# Check syntax: Use #10H for hex, not #10
# Verify register names: Use A, R0-R7
# Example: MOV A, #4FH (correct) vs MOV A, #4F (incorrect)

Q: UI not loading properly

# Clear Streamlit cache
streamlit cache clear
# Restart the application
streamlit run main.py --server.port 8502

๐Ÿ“ž Contact & Support

๐Ÿ‘จโ€๐Ÿ’ป Developer: het004

GitHub LinkedIn Email

๐Ÿ› Issues: Report bugs | ๐Ÿ’ก Feature Requests: Suggest features


๐Ÿ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ™ Acknowledgments

๐ŸŒŸ Special Thanks To:

  • ๐ŸŽ“ Intel Corporation - For the 8051 microcontroller architecture
  • ๐Ÿš€ Streamlit Team - For the excellent web framework
  • ๐Ÿ‘จโ€๐ŸŽ“ Educational Community - For feedback and testing
  • ๐Ÿ’ป Open Source Contributors - For inspiration and guidance

โญ Star this repository if you found it helpful!

Built with โค๏ธ for embedded systems education and development

Footer


About

8051 Assembler GUI Interactive web-based 8051 microcontroller assembler and simulator for educational and development purposes.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages