# too101/read architecture

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

- Interactive diagram: https://gitdiagram.com/too101/read
- Repository: https://github.com/too101/read

## Overview

READ is a full-screen Thai TIS-620 text viewer implemented as DOS, Windows, and Linux ports. The user opens a text file (or sees built-in help), then navigates and views it with Thai byte handling, combining marks, and WordStar-style text effects; Windows and Linux adapt the visible layout to a resizable window. The map keeps each port’s runtime together and highlights the Linux port’s sampled internal rendering and event-handling layers. DOS and Windows internals are represented only at the level documented in the README; their source was not sampled.

Main entry points: [`linux/src/read_linux.c`](https://github.com/too101/read/blob/main/linux/src/read_linux.c) (Linux viewer), [`dos/read.asm`](https://github.com/too101/read/blob/main/dos/read.asm) (DOS viewer), [`windows/src/read_win.asm`](https://github.com/too101/read/blob/main/windows/src/read_win.asm) (Windows viewer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dos["DOS port"]
  node_dos_viewer["DOS viewer<br/>[read.asm]"]
end

subgraph group_windows["Windows port"]
  node_win_viewer["Windows viewer<br/>[read_win.asm]"]
end

subgraph group_linux["Linux port"]
  node_linux_app["Linux viewer<br/>[read_linux.c]"]
  node_linux_text["Thai text handling<br/>[read_linux.c]"]
  node_linux_lines["Line table<br/>[read_linux.c]"]
  node_linux_render["Cell rendering<br/>[read_linux.c]"]
  node_linux_events["Input and resize<br/>[read_linux.c]"]
  node_linux_window["X11 display<br/>[read_linux.c]"]
end

node_user(("Reader"))
node_textfile["Text file"]

node_user -->|"opens and navigates"| node_dos_viewer
node_textfile -->|"reads"| node_dos_viewer
node_user -->|"opens and navigates"| node_win_viewer
node_textfile -->|"reads"| node_win_viewer
node_user -->|"opens and navigates"| node_linux_app
node_textfile -->|"reads"| node_linux_app
node_linux_app -->|"classifies bytes"| node_linux_text
node_linux_app -->|"builds line table"| node_linux_lines
node_linux_app -->|"handles events"| node_linux_events
node_linux_events -->|"updates view state"| node_linux_app
node_linux_app -->|"renders view"| node_linux_render
node_linux_render -->|"presents image"| node_linux_window
node_linux_events -->|"resizes window"| node_linux_window

click node_dos_viewer "https://github.com/too101/read/blob/main/dos/read.asm"
click node_win_viewer "https://github.com/too101/read/blob/main/windows/src/read_win.asm"
click node_linux_app "https://github.com/too101/read/blob/main/linux/src/read_linux.c"
click node_linux_text "https://github.com/too101/read/blob/main/linux/src/read_linux.c"
click node_linux_lines "https://github.com/too101/read/blob/main/linux/src/read_linux.c"
click node_linux_render "https://github.com/too101/read/blob/main/linux/src/read_linux.c"
click node_linux_events "https://github.com/too101/read/blob/main/linux/src/read_linux.c"
click node_linux_window "https://github.com/too101/read/blob/main/linux/src/read_linux.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dos_viewer toneBlue
class node_win_viewer toneAmber
class node_linux_app,node_linux_text,node_linux_lines,node_linux_render,node_linux_events,node_linux_window toneMint
class node_user,node_textfile toneIndigo
```

## Components

### DOS port

- [DOS viewer](https://github.com/too101/read/blob/main/dos/read.asm): `dos/read.asm`

### Windows port

- [Windows viewer](https://github.com/too101/read/blob/main/windows/src/read_win.asm): `windows/src/read_win.asm`

### Linux port

- [Linux viewer](https://github.com/too101/read/blob/main/linux/src/read_linux.c): `linux/src/read_linux.c`
- [Thai text handling](https://github.com/too101/read/blob/main/linux/src/read_linux.c): `linux/src/read_linux.c`
- [Line table](https://github.com/too101/read/blob/main/linux/src/read_linux.c): `linux/src/read_linux.c`
- [Cell rendering](https://github.com/too101/read/blob/main/linux/src/read_linux.c): `linux/src/read_linux.c`
- [Input and resize](https://github.com/too101/read/blob/main/linux/src/read_linux.c): `linux/src/read_linux.c`
- [X11 display](https://github.com/too101/read/blob/main/linux/src/read_linux.c): `linux/src/read_linux.c`

### Other components

- **Reader**
- **Text file**

## Connections

- Reader → DOS viewer: opens and navigates
- Text file → DOS viewer: reads
- Reader → Windows viewer: opens and navigates
- Text file → Windows viewer: reads
- Reader → Linux viewer: opens and navigates
- Text file → Linux viewer: reads
- Linux viewer → Thai text handling: classifies bytes
- Linux viewer → Line table: builds line table
- Linux viewer → Input and resize: handles events
- Input and resize → Linux viewer: updates view state
- Linux viewer → Cell rendering: renders view
- Cell rendering → X11 display: presents image
- Input and resize → X11 display: resizes window
