# microsoft/ms-dos architecture

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

- Interactive diagram: https://gitdiagram.com/microsoft/ms-dos
- Repository: https://github.com/microsoft/ms-dos

## Overview

This tree is a slice of the MS-DOS 4.00 source, not a single application. Its visible product surface includes command-line utilities, disk setup and selection, memory management, and disk-cache control. The clearest user-to-result flow in the excerpts is BACKUP: it initializes, validates drives and paths, parses options, then performs backup work. The graph preserves the other substantial command and system modules listed in the source index; their internal links are mostly omitted because their call relationships were not shown.

Main entry points: [`v4.0/src/CMD/BACKUP/BACKUP.C`](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/BACKUP/BACKUP.C) (Backup utility), [`v4.0/src/CMD/RESTORE/RESTPARS.C`](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/RESTORE/RESTPARS.C) (Restore parsing), [`v4.0/src/CMD/FDISK/MAIN.C`](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/FDISK/MAIN.C) (Partition manager), [`v4.0/src/MEMM/EMM/EMM40.C`](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/MEMM/EMM/EMM40.C) (Expanded memory manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_commands["DOS Commands"]
  node_backup["Backup utility<br/>[BACKUP.C]"]
  node_backupopts["Backup options<br/>[BACKPARS.H]"]
  node_attrib["File attributes<br/>[ATTRIB.C]"]
  node_attribopts["Attribute options<br/>[PARSE.H]"]
  node_fc["File comparison<br/>[FC.C]"]
  node_restoreparse["Restore parsing<br/>[RESTPARS.C]"]
  node_restorefile["Restore files<br/>[RTFILE.C]"]
  node_restoreold["Restore legacy data<br/>[RTOLD1.C]"]
  node_filesys["Device assignment<br/>[FILESYS.C]"]
  node_join["Drive joining<br/>[JOIN.C]"]
  node_mem["Memory reporting<br/>[MEM.C]"]
  node_replace["File replacement<br/>[REPLACE.C]"]
  node_subst["Drive substitution<br/>[SUBST.C]"]
end

subgraph group_disk["Disk Utilities"]
  node_fdisk["Partition manager<br/>[MAIN.C]"]
  node_fdiskcalls["Disk call interface<br/>[DOSCALL.H]"]
  node_selectstat["Disk status transfer<br/>[GET_STAT.C]"]
  node_selectint["Disk interrupt support<br/>[INT13.C]"]
end

subgraph group_memory["Memory and Cache"]
  node_emm["Expanded memory manager<br/>[EMM40.C]"]
  node_emmfunc["EMM page functions<br/>[EMMFUNCT.C]"]
  node_mapdma["DMA page mapping<br/>[MAPDMA.C]"]
  node_flush["Cache control<br/>[FLUSH13.C]"]
end

subgraph group_system["System Support"]
  node_incsupport["DOS runtime helpers<br/>[ERRTST.C]"]
  node_messages["Shared message definitions<br/>[UTILMID.H]"]
end

node_user(("DOS user"))

node_user -.->|"runs command"| node_backup
node_backup -.->|"parses options"| node_backupopts
node_backup -->|"initializes and validates"| node_backup
node_user -.->|"runs command"| node_attrib
node_user -.->|"runs command"| node_fc
node_user -.->|"runs command"| node_fdisk
node_fdisk -.->|"uses disk calls"| node_fdiskcalls
node_user -.->|"runs command"| node_filesys
node_user -.->|"runs command"| node_restoreparse
node_restoreparse -.->|"dispatches restore"| node_restorefile
node_restoreparse -.->|"dispatches restore"| node_restoreold
node_selectstat -.->|"reads disk status"| node_selectint
node_emm -.->|"uses page functions"| node_emmfunc
node_mapdma -.->|"remaps EMM pages"| node_emm

click node_backup "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/BACKUP/BACKUP.C"
click node_backupopts "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/BACKUP/BACKPARS.H"
click node_attrib "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/ATTRIB/ATTRIB.C"
click node_attribopts "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/ATTRIB/PARSE.H"
click node_fc "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/FC/FC.C"
click node_restoreparse "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/RESTORE/RESTPARS.C"
click node_restorefile "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/RESTORE/RTFILE.C"
click node_restoreold "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/RESTORE/RTOLD1.C"
click node_filesys "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/FILESYS/FILESYS.C"
click node_join "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/JOIN/JOIN.C"
click node_mem "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/MEM/MEM.C"
click node_replace "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/REPLACE/REPLACE.C"
click node_subst "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/SUBST/SUBST.C"
click node_fdisk "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/FDISK/MAIN.C"
click node_fdiskcalls "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/FDISK/DOSCALL.H"
click node_selectstat "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/SELECT/GET_STAT.C"
click node_selectint "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/SELECT/INT13.C"
click node_emm "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/MEMM/EMM/EMM40.C"
click node_emmfunc "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/MEMM/EMM/EMMFUNCT.C"
click node_mapdma "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/MEMM/MEMM/MAPDMA.C"
click node_flush "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/DEV/SMARTDRV/FLUSH13.C"
click node_incsupport "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/INC/ERRTST.C"
click node_messages "https://github.com/microsoft/ms-dos/blob/main/v4.0/src/H/UTILMID.H"

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_backup,node_backupopts,node_attrib,node_attribopts,node_fc,node_restoreparse,node_restorefile,node_restoreold,node_filesys,node_join,node_mem,node_replace,node_subst,node_user toneBlue
class node_fdisk,node_fdiskcalls,node_selectstat,node_selectint toneAmber
class node_emm,node_emmfunc,node_mapdma,node_flush toneMint
class node_incsupport,node_messages toneRose
```

## Components

### DOS Commands

- [Backup utility](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/BACKUP/BACKUP.C): `v4.0/src/CMD/BACKUP/BACKUP.C`
- [Backup options](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/BACKUP/BACKPARS.H): `v4.0/src/CMD/BACKUP/BACKPARS.H`
- [File attributes](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/ATTRIB/ATTRIB.C): `v4.0/src/CMD/ATTRIB/ATTRIB.C`
- [Attribute options](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/ATTRIB/PARSE.H): `v4.0/src/CMD/ATTRIB/PARSE.H`
- [File comparison](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/FC/FC.C): `v4.0/src/CMD/FC/FC.C`
- [Restore parsing](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/RESTORE/RESTPARS.C): `v4.0/src/CMD/RESTORE/RESTPARS.C`
- [Restore files](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/RESTORE/RTFILE.C): `v4.0/src/CMD/RESTORE/RTFILE.C`
- [Restore legacy data](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/RESTORE/RTOLD1.C): `v4.0/src/CMD/RESTORE/RTOLD1.C`
- [Device assignment](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/FILESYS/FILESYS.C): `v4.0/src/CMD/FILESYS/FILESYS.C`
- [Drive joining](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/JOIN/JOIN.C): `v4.0/src/CMD/JOIN/JOIN.C`
- [Memory reporting](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/MEM/MEM.C): `v4.0/src/CMD/MEM/MEM.C`
- [File replacement](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/REPLACE/REPLACE.C): `v4.0/src/CMD/REPLACE/REPLACE.C`
- [Drive substitution](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/SUBST/SUBST.C): `v4.0/src/CMD/SUBST/SUBST.C`

### Disk Utilities

- [Partition manager](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/FDISK/MAIN.C): `v4.0/src/CMD/FDISK/MAIN.C`
- [Disk call interface](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/CMD/FDISK/DOSCALL.H): `v4.0/src/CMD/FDISK/DOSCALL.H`
- [Disk status transfer](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/SELECT/GET_STAT.C): `v4.0/src/SELECT/GET_STAT.C`
- [Disk interrupt support](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/SELECT/INT13.C): `v4.0/src/SELECT/INT13.C`

### Memory and Cache

- [Expanded memory manager](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/MEMM/EMM/EMM40.C): `v4.0/src/MEMM/EMM/EMM40.C`
- [EMM page functions](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/MEMM/EMM/EMMFUNCT.C): `v4.0/src/MEMM/EMM/EMMFUNCT.C`
- [DMA page mapping](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/MEMM/MEMM/MAPDMA.C): `v4.0/src/MEMM/MEMM/MAPDMA.C`
- [Cache control](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/DEV/SMARTDRV/FLUSH13.C): `v4.0/src/DEV/SMARTDRV/FLUSH13.C`

### System Support

- [DOS runtime helpers](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/INC/ERRTST.C): `v4.0/src/INC/ERRTST.C`
- [Shared message definitions](https://github.com/microsoft/ms-dos/blob/main/v4.0/src/H/UTILMID.H): `v4.0/src/H/UTILMID.H`

### Other components

- **DOS user**

## Connections

- DOS user → Backup utility: runs command
- Backup utility → Backup options: parses options
- Backup utility → Backup utility: initializes and validates (evidence: `v4.0/src/CMD/BACKUP/BACKUP.C`)
- DOS user → File attributes: runs command
- DOS user → File comparison: runs command
- DOS user → Partition manager: runs command
- Partition manager → Disk call interface: uses disk calls
- DOS user → Device assignment: runs command
- DOS user → Restore parsing: runs command
- Restore parsing → Restore files: dispatches restore
- Restore parsing → Restore legacy data: dispatches restore
- Disk status transfer → Disk interrupt support: reads disk status
- Expanded memory manager → EMM page functions: uses page functions
- DMA page mapping → Expanded memory manager: remaps EMM pages
