How to boot SOS on PC motherboard

Thread Starter

modobo

Joined Apr 23, 2013
31
Im currently writing a small program in qbasic on msdos. My question is can I use c to write a program that can run on a pc without having to load windows first. Is there any code that can run immediately the pc leaves the bios, an os free program?
 

dl324

Joined Mar 30, 2015
16,922
It depends.

Give us more details about the computer. What boot devices are available? What is the boot order?

Do some research on bootable floppies, CD/DVD, etc.
 
Im currently writing a small program in qbasic on msdos. My question is can I use c to write a program that can run on a pc without having to load windows first. Is there any code that can run immediately the pc leaves the bios, an os free program?
The quick answer is Yes and No. Yes, it is possible and No, because it is too difficult for you to do. Sorry if that seems condescending.
 

MaxHeadRoom

Joined Jul 18, 2013
28,688
The way of running a program usually with MSDOS on boot up is a .BAT file.
Incidentally, do you have the latest (ripped from WIN-XP) Dos 7.1?
Also there are drivers out there to allow USB port I/O for DOS, the down side is the USB stick has to be in the machine when booted, i.e. no hot swap.
Max.
 

MrChips

Joined Oct 2, 2009
30,810
Perfectly doable.
Firstly, you will need to find some textbooks or reference manuals on the PC BIOS and DOS.
I suggest that you learn 8086 ASM programming in order to do this. You will need to call INT functions in BIOS.
 

LesJones

Joined Jan 8, 2017
4,190
Hi Max,
I would be interested to know how to rip off DOS 7.1 from XP.

modobo,
Here are two books that I would reccomend if you plan to do A86 assembly programming.
Allen L. Wyatt Using assembler language
The waite Group's MD-DOS Bible
They are quite expensive new but you may find second hand copies.

Les.
 

LesJones

Joined Jan 8, 2017
4,190
Many thanks for the links Max. I misunderstood your meaning of riping it off from XP. I thought you meant that the files in XP that give the command prompt could be used to create DOS V7.1 I had to get back into A86 assembler about a year ago to read and write a DS1225 NV RAM chip for my tektronix 2465b scope. I like the fact that under DOS you can talk directly to the hardware and it is easy to use INT functions in the BIOS for things like writing to a file.

Les.
 

MaxHeadRoom

Joined Jul 18, 2013
28,688
Some of the added features for DOS is support for long file names, support for the FAT 32 file system, out of the box mouse support, a GUI setup upon first boot up.
Max.
 
Perfectly doable.
Firstly, you will need to find some textbooks or reference manuals on the PC BIOS and DOS.
I suggest that you learn 8086 ASM programming in order to do this. You will need to call INT functions in BIOS.
No need for textbooks on DOS since the TS is asking "Is there any code that can run immediately the pc leaves the bios, an os free program?" A program requiring an OS, like DOS, would clearly not answer the question.

@modobo if you really want to pursue this, read this thread and see if it makes sense to you. I think that there is a lot of good information on the subject there.

If it does make sense to you and you are up for it, a simple search will start you on your way.

As I said in my first response to "A Quick Question", The quick answer is Yes and No. Yes, it is possible and No, because it is too difficult for you to do. Pending learning more, I'm going to stick with that answer.

Now if you mean to boot up the PC, load a DOS and start your program, that is another matter and a very different matter than what you asked. If that is where you want to go you may want to look into FreeDOS as well as many of the other posts in this thread.
 

MrChips

Joined Oct 2, 2009
30,810
The other question one should ask is "why do you want to do this?".

Rather than try to use a old motherboard that requires a big power supply, I would rather program an ARM chip that has all the Flash memory, SRAM and I/O functions for everything I would need, all in one chip.
 

Thread Starter

modobo

Joined Apr 23, 2013
31
Hi guys, thanks for all the responses. I think the best ones were the ones that made mention of the assembler language though thats just too stressful, I think I will stick to msdos and qbasic for now. I'd have thought that Windows did away with DOS long time ago so it would had been nice for me to have written a program that could run like a OS without msdos in the middle but not in machine code though anyway thanks all for ur support.
 

MrSoftware

Joined Oct 29, 2013
2,200
Yes you can write a program in C that will run by itself on the processor. There might need to be some assembly sections in it, I'm not sure, it probably depends on your compiler. The more processor features you want to use, the more complicated it will be. Take a look at Linux. It's open source from top to bottom, so you can look at the boot loader code to see how they bring the processor up. It would also help to read some documentation on the subject as I suspect the code will make a lot more sense if you have a high level understanding for what the low level code is doing. Maybe something like this would be a good starting point:

https://en.wikibooks.org/wiki/X86_Assembly/Bootloaders

https://en.wikibooks.org/wiki/X86_Assembly/Protected_Mode
 
Top