# rusty-jar/neo8085 architecture

> Architecture diagram of the GitHub repository rusty-jar/neo8085, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rusty-jar/neo8085
- Repository: https://github.com/rusty-jar/neo8085

## Overview

##### Main Components
- User Interface (UI) / IDE: This is the front end that users interact with. It includes the assembly code editor (with syntax highlighting, breakpoint handling, etc.), menu controls for file operations, and display panels for registers, flags, and memory.
- Assembler Module: Located in src/assembler.py, it handles parsing and converting 8085 assembly language into machine instructions. It deals with symbolic resolution, directive processing (like EQU and DS), and error reporting.
- Processor/Simulator Module: Found in src/processor.py, this module simulates the 8085 microprocessor’s operations, including register/flag updates and memory manipulations during step-by-step or continuous execution.
- Application Entry Point: The src/main.py file serves as the glue that initializes the UI, ties together the assembler and processor components, and manages overall application flow.
- External Dependencies: Emphasize that the project relies on PySide6 (Qt for Python) for the GUI and that its operations use Python’s runtime environment.

##### Relationships and Interactions
- The UI sends user-written 8085 assembly code to the Assembler Module when the "Assemble" action is triggered.
- The Assembler Module processes the code (e.g., resolving directives and labels) and returns either assembled machine code or error messages.
- On successful assembly, the machine code is passed to the Processor Module, which simulates the microprocessor’s execution.
- As the Processor Module executes instructions (either step-by-step or continuously), it communicates updated register states, flag statuses, and memory changes back to the UI for real-time visualization.
- The main application (main.py) coordinates these interactions, ensuring a smooth flow from code input to simulation output.

##### Architectural Patterns and Design Principles
- Modular Design: Each module (assembler, processor, and main UI) is independently developed and maintained. This modularity allows for potential extension or replacement of components without affecting the rest of the system.
- Event-Driven Interaction: The UI primarily functions as an event handler (button clicks, key presses) that triggers operations in the assembler and processor modules.

## Diagram (Mermaid)

```mermaid
flowchart TD
    MC("Main Application Controller (src/main.py)"):::controller
    UI("IDE / Frontend (PySide6)"):::ui
    ASM("Assembler Module (src/assembler.py)"):::assembler
    PROC("Processor Simulator (src/processor.py)"):::processor

    MC -->|"initializes"| UI
    MC -->|"initializes"| ASM
    MC -->|"initializes"| PROC

    UI -->|"triggers_assembly"| ASM
    ASM -->|"returns_machine_code_or_error"| UI
    ASM -->|"passes_machine_code"| PROC
    UI -->|"triggers_execution"| PROC
    PROC -->|"updates_simulation_state"| UI

    click UI "https://github.com/rusty-jar/neo8085/blob/main/src/main.py"
    click ASM "https://github.com/rusty-jar/neo8085/blob/main/src/assembler.py"
    click PROC "https://github.com/rusty-jar/neo8085/blob/main/src/processor.py"
    click MC "https://github.com/rusty-jar/neo8085/blob/main/src/main.py"

    classDef ui fill:#AEDFF7,stroke:#333,stroke-width:1px;
    classDef assembler fill:#FFDAB9,stroke:#333,stroke-width:1px;
    classDef processor fill:#C1FFC1,stroke:#333,stroke-width:1px;
    classDef controller fill:#FFD700,stroke:#333,stroke-width:1px;
```
