-
July 19th, 2004, 04:13 AM
#11
Junior Member
Oh ok, I have Windows ME In case that helps anyones responce....
and how would I put a link in the MBR?
Yes I am a criminal, My crime is that of curiosity -- ++mentor+++
-
July 19th, 2004, 04:17 AM
#12
Hell if I know... You would have to be a VERY good programmer (which I assume you are not) and use some sort of boot disk with your program on it that would allow you to write to the MBR...
[H]ard|OCP <--Best hardware/gaming news out there--|
pwned.nl <--Gamers will love this one --|
Light a man a fire and you\'ll keep him warm for a day, Light a man ON fire and you\'ll keep him warm the rest of his life.
-
July 19th, 2004, 04:20 AM
#13
Junior Member
Yea, Im not that good... I can make basic games but thats about it.... (like missle command and ect.) Any easyer ways?
Yes I am a criminal, My crime is that of curiosity -- ++mentor+++
-
July 19th, 2004, 07:12 AM
#14
This is what happens when you boot your PC:
Firstly, the BIOS is executed from a chip held on your motherboard.
This is a very basic, low level program, which checks out the hardware on your PC (memory, hard drives, other standard devices etc.). It has nothing whatsoever to do with your OS and will work in exactly the same way on linux as in Windows (or anything else, come to that!).
And, no you don't want to tamper with this, except perhaps to install an upgrade from your manufacturer to support new hardware.
Each BIOS uses its own unique code, and each mother board is designed to run a particular type of BIOS.
Next, assuming your PC is working, the BIOS will find your primary hard drive.
It then looks for a special part of the hard drive which is located at the very first part of your hard drive (Cylinder 0; Head 0; Sector 1) which is known as the MBR (master boot record).
This will execute a simple sequence of instructions to start to load your OS - when I say simple we are talking about 512 bytes here - the size of memory I had when I first started programming
So, yes, you do need to program this in assembler (x86 if you are using an Intel chip), but the way Windows and linux work is that the whole of the first cylinder (usually 32Kb) is not used, so your basic 512 byte program can link to code stored in this area, as they do.
This code can be written in C/C++, but you need to be very careful, as most system calls will not work, but anyway you'll end up with some binary code, which you can write to this part of the hard drive.
So when you boot, your BIOS loads the MBR, which in turn usually executes the rest of the code you have stored in Cylinder 0, which in Windows & linux presents you with a basic menu (if you choose to enable it), and then your system completes its boot.
Needless to say, if you get your code wrong, then your PC won't boot until you replace the MBR, together with the rest of the code stored in Cylinder 0.
-
July 19th, 2004, 08:09 AM
#15
How about this. What is the goal of the program you want to write?
-
July 19th, 2004, 06:28 PM
#16
Oh, Should have added that if you setup your BIOS to boot from a floppy first (which is normal setup), CD, even USB memory sticks, then it will treat them in exactly the same way as a HD, i.e. look for the very first piece of information stored on the device and take it from there.
This is an easy way to test things, as you leave your HD alone, and put the new code on your floppy or whatever, and see what happens when you boot from it ..
Plenty of utilities on the net which you can find via google which will let you setup a floppy to do this.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|