```
                       .    ,__          .           _     
 \,___,   ___    ____ _/_   /  `   ___  _/_     ___  /     
 |    \  /   `  (      |    |__  .'   `  |    .'   ` |,---.
 |    | |    |  `--.   |    |    |----'  |    |      |'   `
 |`---' `.__/| \___.'  \__/ |    `.___,  \__/  `._.' /    |
 \                          /                              

```

In the tradition of the widely popular `fastfetch` or `neofetch` tools on Linux, `pastfetch` is a DOS utility that prints a compact block of information about the running system along with a fancy logo. 

It is designed for real DOS distributions, FreeDOS, SvarDOS, and popular emulators (DOSBox, DOSBox-X/Staging, DOSEMU, etc.). 

ANSI logos are embedded; an ASCII fallback is used when ANSI output is unavailable.

A selection of gorgeous ANSI Logos for a variety of DOS flavors has been specifically designed for and contributed to the project by [JONINSCII](https://www.instagram.com/joninscii).

## Requirements

To see the logos in all their glory you need to have an ANSI driver installed in CONFIG.SYS. A free NANSI.SYS driver is shipped with this repository.

## Features
- DOS flavour detection using `ver`, environment markers, OEM hints, and DR-DOS signature checks (DR-DOS/Novell DOS/SvarDOS/DOSBox variants/Dosemu/Dosbian/PC DOS/MS-DOS/FreeDOS/etc.)
- True DOS version and flags via INT 21h/3306h (ROM/HMA bits noted)
- Active shell derived from `COMSPEC`
- Basic machine identity from INT 15h/C0h (OpenWatcom builds) or a generic label
- CPU class (8086/8088 vs. 286 vs. 386+)
- Conventional and extended memory sizes via BIOS interrupts
- Drive `C:` total and free space (INT 21h/36h)
- Current text mode dimensions and adapter description, VESA presence flag, plus a palette sample read via INT 10h/1015h
- `CONFIG.SYS` `DEVICE`/`DEVICEHIGH`/`INSTALL` entries (summarised) and ANSI driver detection
- 16-colour swatches when ANSI output is active

## Screenshots

|   |   |   |
|:---:|:---:|:---:|
| <a href="screenshots/msdos.png"><img src="screenshots/msdos.png" width="260" alt="MS-DOS 6.22"></a><br>MS-DOS 6.22 | <a href="screenshots/msdos_noansi.png"><img src="screenshots/msdos_noansi.png" width="260" alt="MS-DOS 6.22 - /noansi"></a><br>MS-DOS 6.22 &mdash; `/noansi` | <a href="screenshots/freedos.png"><img src="screenshots/freedos.png" width="260" alt="FreeDOS 1.4"></a><br>FreeDOS 1.4 |
| <a href="screenshots/drdos.png"><img src="screenshots/drdos.png" width="260" alt="Caldera DR-DOS 7.03"></a><br>Caldera DR-DOS 7.03 | <a href="screenshots/novelldos.png"><img src="screenshots/novelldos.png" width="260" alt="Novell DOS 7"></a><br>Novell DOS 7 | <a href="screenshots/ibmpcdos.png"><img src="screenshots/ibmpcdos.png" width="260" alt="IBM PC DOS 7.0"></a><br>IBM PC DOS 7.0 |
| <a href="screenshots/dosbox.png"><img src="screenshots/dosbox.png" width="260" alt="DOSBox 0.74-3"></a><br>DOSBox 0.74-3 | <a href="screenshots/dosbox-x.png"><img src="screenshots/dosbox-x.png" width="260" alt="DOSBox-X 2026.05.02"></a><br>DOSBox-X 2026.05.02 | <a href="screenshots/dosbox-staging.png"><img src="screenshots/dosbox-staging.png" width="260" alt="DOSBox Staging 0.82.2"></a><br>DOSBox Staging 0.82.2 |
| <a href="screenshots/86_dos_logo.png"><img src="screenshots/86_dos_logo.png" width="260" alt="86-DOS logo"></a><br>86-DOS logo | <a href="screenshots/concurrent_logo.png"><img src="screenshots/concurrent_logo.png" width="260" alt="Concurrent DOS logo"></a><br>Concurrent DOS logo | <a href="screenshots/dosbian_logo.png"><img src="screenshots/dosbian_logo.png" width="260" alt="Dosbian logo"></a><br>Dosbian logo |
| <a href="screenshots/dosv.png"><img src="screenshots/dosv.png" width="260" alt="IBM DOS J5.0/V"></a><br>IBM DOS J5.0/V | <a href="screenshots/dosv_noansi.png"><img src="screenshots/dosv_noansi.png" width="260" alt="IBM DOS J5.0/V - /noansi"></a><br>IBM DOS J5.0/V &mdash; `/noansi` | |

## Background

At first, I planned to contribute to Leah Neukirchen's quite rudimentary [DOSfetch](https://github.com/leahneukirchen/dosfetch), but with no Pascal coding experience the task felt a bit too daunting. I briefly looked into porting it to QBASIC before eventually settling on the much more approachable [OpenWatcom C](https://openwatcom.org/).

What had started as a 'simple and fun weekend project' of a nostalgic xennial dweeb quickly turned into an endless rabbit hole of digging through archive.org to find ancient DOS [installation floppy images](https://archive.org/search?tab=all&query=DOS+floppy), investigating the forgotten realms of [interrupts](https://www.ctyme.com/rbrown.htm), and diving into source code of [MS-DOS](https://github.com/microsoft/MS-DOS) and the [DR-DOS kernel](https://github.com/SvarDOS/edrdos). 

I came out with the realization that from today's perspective even with a seemingly 'simple' operating system, all the different DOS flavors and variants have their own weird quirks and unique characteristics that made it more difficult to realize this project than anticipated. Eventually I got it to work on several different popular DOS emulators with different DOS 'distros' and on bare-metal DOS installations on my trusty old ThinkPad X220.

This work would have massively exceeded its scope without the assistance of ChatGPT Codex digging through 1980s source code and help debug and refine my sloppy C code.

After months of putting the project off because I was so worn down by spending days wrestling with weird memory hiccups and rendering glitches I was pretty close to giving up on the whole thing. What kept me going were [JONINSCII](https://www.instagram.com/joninscii)'s steady motivational nudges and the patient detective work of Claude Opus, which eventually managed to iron out the quirks.

## Logos
Built-in ANSI logos for: 
- `86_dos`
- `concurrentdos`
- `dos`
- `dosbian`
- `dosbox`
- `dosbox_staging`
- `dosbox_x`
- `dr_dos`
- `freedos`
- `ms_dos`
- `novell_dos`
- `pc_dos`.

## Usage
Copy `pf.exe` onto your DOS system or emulator and run:

```dos
pf [options]
```

Options:
- `/?` show the inline help
- `/list` or `--list` show the built-in logo names and exit
- `/logo NAME` or `--logo NAME` force a particular logo (see `/list`)
- `/nologo` disable ANSI art while keeping the info table
- `/noansi` or `--noansi` force ASCII-only output (also skips colour blocks)
- `/r` or `--prompt-fix` emit an extra ANSI reset/newline for shells that keep colours in the prompt
- `/safe` use the normal CRT cleanup/exit path (default is fast exit)

## Building
The `Makefile` targets DOS MZ executables:

```sh
make            # builds build/pf.exe using OpenWatcom wcl by default
make clean      # removes build/ and any leftover .obj files
```

- Use `make CC=owcc` if you prefer the OpenWatcom `owcc` front-end (source `owsetenv.sh`/`owsetenv.bat` first).
- `make djgpp` builds with `i586-pc-msdosdjgpp-gcc` (DJGPP cross toolchain).
- Override `CC`, `CFLAGS`, and `LDFLAGS` for other DOS-targeting compilers that provide `int86`/`intdos` equivalents.
- Source formatting is described by `.clang-format`; run `clang-format -i src/*.c include/*.h` before sending a patch.

### Devbox

If you use [devbox](https://www.jetify.com/devbox) for the build env, here are some handy scripts:

```sh
devbox run build     # build/pf.exe via OpenWatcom wcl
devbox run clean     # removes build/ and dist/
devbox run rebuild   # clean + build
devbox run logos     # regenerate src/logos_data.inc from logos/*.ans
devbox run dist      # dist/pastfetch.zip release bundle (pf.exe + NANSI.SYS + docs)
```

`src/logos_data.inc` is generated and must not be hand-edited: change the art in `logos/`
and re-run `devbox run logos`, which drives `tools/generate_logos_data.py`.

## Testing

Thus far I was only able to test pastfetch in the following configurations:

| DOS Flavor          | Emulated | Bare Metal         |
|---------------------|----------|--------------------|
| Caldera DR-DOS 7.03 | ✅       | untested           |
| FreeDOS 1.4         | ✅       | untested           |
| IBM PC DOS 7.0      | ✅       | 🪲 no return to prompt|
| IBM DOS J5.0/V      | logo ANSI block shown as japanese characters         | untested                 |
| MS-DOS 6.22         | ✅       | ✅
| DOSBox 0.74-3       | ✅       | emulator only |
| DOSBox Staging 0.82.2| ✅      | emulator only
| DOSBox-X 2026.05.02 | ✅       | emulator only |
| Novell DOS 7        | ✅       | untested      |
| SvarDOS 20250427    | ✅       | ✅            |

## Known Bugs

- IBM PC-DOS sometimes does not return to the `C:\>` shell. Unresolved, and not reproducible in any of my emulated environments, but present on a bare metal installation. 


## Contribution

- I am eagerly looking for contributors to test pastfetch on different hardware with different DOS distros. 
- Also folks who know a bit more about DOS and 16 bit computing and have more experience that would help make this a more solid piece of software.
- If you have more feature ideas and know your way around C a bit, give it a shot

## License

- Software and source code © by Tobias Raayoni Last, licensed under [MIT](https://mit-license.org/)
- Logos and artwork © by Joninscii, licensed under [Creative Commons BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)
