Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Assembly (http://www.programmingforums.org/forum20.html)
-   -   Can I ask one further question? (http://www.programmingforums.org/showthread.php?t=8109)

CodeJunkie Jan 25th, 2006 12:54 PM

Can I ask one further question?
 
Can anybody advise me, how would I go about creating a self booting program on a self booting disk?

For example if I were to create a suitable 3.5" floppy disk that contained my assembly program and then is placed into the disk drive.
Following a system reset (and boot strap permitting) my assembly program would then start up from the diskette, without any further prompting from the user.

Thankyou in advance to anybody that replies

(Im currently writing programs using the MASM compiler, and a text editor.)

DaWei Jan 25th, 2006 1:10 PM

Indeed you can. The fact that you are asking indicates that you have a substantial amount to learn. In the typical PC, when you power up, the only software available is that which resides in the BIOS (Basic Input/Output System). There's quite a bit there, substantially more than in the original PCs, but it is, indeed, basic. It knows how to deal with keyboard, monitor, and disk I/O. There is no real executive - that's the job of the software that will boot. The boot record of the medium that is booted from will be placed in memory at a particular location and the processor will then be set to execute from a particular address. From there, everything is up to you.

I would suggest that you get your hands on an old MS-DOS diskette, say 3.3, get some ancient books dealing with MS-DOS, and work from there. You could also use C/PM, and old Unix or QNX, DRDOS, or a number of other things. MS-DOS is terrible, non-reentrant, but you would no doubt have more success locating documentation.

If you take this approach and experiment around, I would recommend you remove your current hard drive or move it to another channel where you're less likely to access it and wipe it out. You will no doubt begin operations in real mode and you won't have the protective measures in place until you put them there yourself.

Historically, a lot of early software was totally independent of even MS-DOS. One booted the whole ball of wax and ran it. Even the early MS Flight Simulators didn't use MS-DOS - it didn't have capabilities to address graphical issues in a timely fashion.

Polyphemus_ Jan 25th, 2006 1:26 PM

There are a couple of tutorials out there on the internet, 15 minutes googling will give you enough results I guess.

Making the computer boot from the floppy is pretty easy: just place a 512 byte big piece of assembly on the first sector of your floppy.
When your piece of assembly code is bigger than 512 byte, you'll have to load that piece into the memory by hand - the BIOS won't do it for you. For an explanation how to do this, use Google, because I don't know how to read from disk in 16 bit mode ;). The handiest is to put the extra piece of assembly on e.g. the 2nd sector, but note you won't be able to use a filesystem anymore.

CodeJunkie Jan 25th, 2006 1:31 PM

Once again thankyou Dawei, I will persue this as you have laid out.

CodeJunkie Jan 25th, 2006 1:35 PM

Sorry I have only just read your post Polyphemus.
Thankyou for your response, I shall indeed google it.
Can you tell me how would I place a program onto a particular sector?

nnxion Jan 25th, 2006 1:46 PM

Search for making on how to make a boot loader and second stage loader.
It's generally discouraged to make your own bootloader, but if you really want to you can roll your own bootloader.

CodeJunkie Jan 25th, 2006 2:13 PM

Thankyou nnxion for your valuable aid!

(This looks extremely complex!, I had better get reading)


All times are GMT -5. The time now is 6:34 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC