Detecting DOSBox from Within the Box
atan2
65 points
15 comments
April 17, 2026
Related Discussions
Found 5 related stories in 95.3ms across 9,294 title embeddings via pgvector HNSW
- DOS Running in a PDF zachlatta · 12 pts · May 31, 2026 · 61% similar
- DOS Zone rglover · 180 pts · May 20, 2026 · 60% similar
- SDL Now Supports DOS Jayschwa · 243 pts · April 24, 2026 · 51% similar
- Continuing the story of early DOS development oldnetguy · 12 pts · April 28, 2026 · 51% similar
- The Official DR DOS Website Tomte · 46 pts · March 15, 2026 · 50% similar
Discussion Highlights (3 comments)
tombert
It never really occurred to me that you'd want to be able to detect if something is running in DOSBox, since I figured that the point was to be as compatible as possible with MS-DOS. I guess it makes sense to try it anyway. Now I'm wondering how I'd be able to detect something like Concurrent DOS or REAL/32 or REAL/NG.
Dwedit
The other way to detect DosBox is a one line Qbasic program PRINT VAL("5"). If it's a 64-bit build made using Visual Studio, you get 4.99999999999. Visual Studio doesn't support legacy 80-bit floating point math for that target. Visual Studio also does not support inline assembly to let you make use of the legacy 80-bit floating point instructions. But if you set the CPU core to "Dynamic", then you get the proper value of "5". Or if you use the MingW builds, those also support 80-bit floating point math and give the correct value of "5". It is quite embarrassing to ship a CPU emulator with broken floating point math as the default.
bananaboy
Neat! I’ve detected it with a simple (less reliable) way in the past for a demo (I forget why I needed to do that). It didn’t occur to me to inspect something like a built in command!