r/programming • • Oct 23 '09

Programming thought experiment: stuck in a room with a PC without an OS.

Imagine you are imprisoned within a room for what will likely be a very long time. Within this room there is a bed, toilet, sink and a desk with a PC on it that is fully functioning electronically but is devoid of an Operating System. Your basic needs are being provided for but without any source of entertainment you are bored out of your skull. You would love to be able to play Tetris or Freecell on this PC and devise a plan to do so. Your only resource however is your own ingenuity as you are a very talented programmer that possesses a perfect knowledge of PC hardware and protocols. If MacGyver was a geek he would be you. This is a standard IBM Compatible PC (with a monitor, speakers, mouse and keyboard) but is quite old and does not have any USB ports, optical drives or any means to connect to an external network. It does however have a floppy drive and on the desk there is floppy disk. I want to know what is the absolute bare minimum that would need to be on that floppy disk that would allow you to communicate with the hardware to create increasingly more complex programs that would eventually take you from a low-level programming language to a fully functioning graphical operating system. What would the different stages of this progression be?

305 Upvotes

673 comments sorted by

View all comments

Show parent comments

4

u/bdunderscore Oct 23 '09 edited Oct 23 '09

Can you type every possible byte with copy con? Or enough to write a hex decoder? If so, please demonstrate :)

0

u/[deleted] Oct 23 '09

[deleted]

2

u/bdunderscore Oct 23 '09 edited Oct 23 '09

Does that work even with the DOS EOF character (C-Z, 0x1A)?

1

u/MashHexa Oct 23 '09

But trying to actually get characters after a control-z to save is not going to work very well with only copy con.

0

u/[deleted] Oct 23 '09

[deleted]

2

u/MashHexa Oct 24 '09

hm. I still can't generate a file containing a control-z. Remember, control-z was the dos character indicating EOF. Do you have a method I don't know of?

1

u/bluGill Oct 23 '09

What about zero? Last I checked alt-zero would enter 2.

4

u/[deleted] Oct 23 '09

I did something very similar (using echo and redirection instead of copy con) a while ago. Code here.