# shingareom/microprocessordiplomaproject architecture

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

- Interactive diagram: https://gitdiagram.com/shingareom/microprocessordiplomaproject
- Repository: https://github.com/shingareom/microprocessordiplomaproject

## Overview

##### Project type and purpose
- This is a single-module, console-based assembly language program written for the x86/DOS environment.
- Its sole function is to prompt the user for a number, search a hard-coded array, and report the index or a “not found” message.

##### File structure
- Top level:
- DiplomaProject.asm: the complete source code (data and code segments).
- README.md: project overview, features, flow, and usage.
- LICENSE: MIT license.
- No subdirectories, no external libraries or services, no build scripts beyond assembling with MASM/TASM.

##### README for additional insights
- Data segment contains:
- myarr (the array), num (user input), index, isfound flag, prompt/result strings.
- Code segment implements:
- DOS interrupts (int 21h) for I/O.
- A loop/compare sequence for the search.
- Conditional jumps to display either “found” or “not found.”

a. Main components:
- User (console)
- DOS I/O interface (int 21h)
- Data Segment (myarr, num, index, flags, strings)
- Code Segment (initialization, input routine, search loop, output routine)
b. Relationships / interactions:
1. User → Console Input Routine (via int 21h) → stores value in num
2. Code Segment’s Search Loop reads myarr & num → updates index & isfound
3. Search Loop → branches to either Found Routine or Not-Found Routine
4. Output Routine → Console Output (via int 21h) → back to DOS / program exit
c. Architectural patterns / principles:
- Separation of Data vs. Code segments (DS: data definitions; CS: logic)
- Linear control-flow with conditional branching (no subroutines or modules)
- Direct hardware/OS calls via interrupts
d. Key technologies / libraries:
- x86 Assembly (MASM/TASM)
- DOS Interrupt 21h (services for keyboard input, screen output, program exit)
- DOS or DOSBox Emulator

##### Detailed breakdown to capture essential elements
- Initialization block: DS setup, clear flags, set index = 0
- Input block: prompt string → int 21h, read key(s) → convert to numeric value → store in num
- Search Loop block:
- Compare myarr[index] with num
- If equal → set isfound, jump to Found block
- Else index++; if index < array_length, loop; else jump to Not-Found
- Found block: display “found” message + index → Exit
- Not-Found block: display “not found” message → Exit
- Exit block: int 21h service to terminate program

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External User
    UserConsole["User / Console"]:::user

    %% External DOS I/O
    DOSIO["DOS I/O (int 21h)"]:::external

    %% Data Segment
    DataSeg["Data Segment\n(myarr, num, index, isfound, strings)"]:::data

    %% Code Segment with sub-components
    subgraph "Code Segment"
        direction TB
        Init["Initialization\n(setup DS, clear flags, index=0)"] 
        Input["Input Routine\n(prompt & read num)"]
        Loop["Search Loop\n(compare & index++, branch)"]
        Found["Found Routine\n(display found & index)"]
        NotFound["Not-Found Routine\n(display not found)"]
        Exit["Exit\n(terminate via int 21h)"]
    end

    %% Documentation nodes
    README["README.md"]:::doc
    LICENSE["LICENSE"]:::doc

    %% Flow of control and data
    UserConsole -->|"keypress"| DOSIO
    DOSIO -->|"deliver input"| Input

    Init --> Input
    Input -->|"store num"| DataSeg
    Input --> Loop

    Loop -->|"read myarr & num"| DataSeg
    Loop -->|"equal"?| Found
    Loop -->|"not equal & more"| Loop
    Loop -->|"not equal & end"| NotFound

    Found -->|"load strings"| DataSeg
    Found -->|"output"| DOSIO
    Found --> Exit

    NotFound -->|"load strings"| DataSeg
    NotFound -->|"output"| DOSIO
    NotFound --> Exit

    Exit -->|"terminate"| DOSIO

    %% Initialization entry
    UserConsole --> Init

    %% Documentation linking
    README
    LICENSE

    %% Click events
    click DataSeg "https://github.com/shingareom/microprocessordiplomaproject/blob/master/DiplomaProject.asm"
    click CodeSeg "https://github.com/shingareom/microprocessordiplomaproject/blob/master/DiplomaProject.asm"
    click DOSIO "https://github.com/shingareom/microprocessordiplomaproject/blob/master/DiplomaProject.asm"
    click README "https://github.com/shingareom/microprocessordiplomaproject/blob/master/README.md"
    click LICENSE "https://github.com/shingareom/microprocessordiplomaproject/tree/master/LICENSE"

    %% Styles
    classDef user fill:#ccc,stroke:#333,stroke-width:1px
    classDef external fill:#cfc,stroke:#333,stroke-width:1px
    classDef data fill:#fffa87,stroke:#333,stroke-width:1px
    classDef code fill:#87cefa,stroke:#333,stroke-width:1px
    classDef doc fill:#eee,stroke:#333,stroke-width:1px
```
