FreeDOS is an open-source operating system designed to be compatible with MS-DOS. It was mainly developed to run old programs and games on modern hardware. Exploring these older systems offers a fascinating glimpse into the history of operating systems, especially when we realize how many mechanisms we take for granted today simply didn’t exist back then.
I’m not even talking about graphical user interfaces but rather basic security principles. For example, DOS systems lack the separation between kernel space and user space, which is a core feature of modern operating systems. This separation, often referred to as privilege levels or ring architecture, ensures stability and security by preventing unauthorized access.
Modern operating systems use a ring architecture that defines different privilege levels for running code. These levels range from Ring 0 (Kernel Mode) to Ring 3 (User Mode):
In contrast, FreeDOS operates without this separation. Every process can access hardware directly, which offers flexibility but also presents security risks.
One interesting example of how easy hardware access used to be is working with the parallel port. I found a great Youtube Video that demonstrates how to control the parallel port with basic QBasic code.
Nowadays, accessing hardware directly without special permissions or drivers would be unthinkable. But with FreeDOS, it’s very straightforward.
Here’s a guide on how to control the parallel port using FreeDOS and QBasic:
cd bin
qbx
Here’s a small program that counts from 1 to 255 and sends the number to the parallel port in binary form while also displaying it on the screen:
FOR COUNT = 0 TO 255 STEP 1
OUT 888, COUNT
PRINT "Number: ", COUNT
SLEEP 1
NEXT COUNT
The number 888
corresponds to the parallel port.
The setup involves connecting the parallel port’s data lines to the positive end of LEDs. All LEDs are connected to the parallel port’s GND
.
Here are two photos of the setup:
|
And here’s a short video showing the counting process: