Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 6th, 2006, 1:03 PM   #1
shadyi
Newbie
 
Join Date: Apr 2006
Posts: 20
Rep Power: 0 shadyi is an unknown quantity at this point
Question assembly boot code

i'm trying to make a startup disk , i want to study the boot code that i will write on the first sector on the disk
anybody can tell me where is that code and what assembler do i use to compile it ?

thanks
shadyi is offline   Reply With Quote
Old May 6th, 2006, 1:33 PM   #2
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
You can use pretty much any assembler to assemble it, and what do you mean "where is that code?" If you're asking for an example, here's one that helped me when I was experimenting a couple of years ago:

http://osdever.net/tutorials/hello_btldr.php?the_id=85

__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower

Last edited by Mjordan2nd; May 6th, 2006 at 6:32 PM.
Mjordan2nd is offline   Reply With Quote
Old May 6th, 2006, 2:16 PM   #3
shadyi
Newbie
 
Join Date: Apr 2006
Posts: 20
Rep Power: 0 shadyi is an unknown quantity at this point
i'll take a look at that
but if u have anything that is quick and easy to write on a floppy boot sector
i want to boot from the floppy the CMD or write anything on the screen
thanks
and it will be alot better if it's compatible with MASM
shadyi is offline   Reply With Quote
Old May 6th, 2006, 2:30 PM   #4
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
I used NASM, so I tried to use more material for NASM. I don't have any of the MASM sites bookmarked, so i can't help you there, but it's the same concept so it shouldn't be too difficult to change the code up a little bit and make it compatible with MASM. Also, I used debug to write to the disk. You could try that.
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower
Mjordan2nd is offline   Reply With Quote
Old May 6th, 2006, 3:00 PM   #5
shadyi
Newbie
 
Join Date: Apr 2006
Posts: 20
Rep Power: 0 shadyi is an unknown quantity at this point
i'm a biginner i couldnt understand most of the code
i just really need to get the job done
and then do the understanding part
i know it sounds crazy but i gotta do it
so how can i get a code straight to a compiler and then write the files to a disk and boot from it ?
thanks for helping me
shadyi is offline   Reply With Quote
Old May 6th, 2006, 5:38 PM   #6
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Why don't you begin your beginneriness with something that clues you in a tad more than you are. Or, if you want someone to do your stuff FOR you, don't beat around the bush, just say so.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 7th, 2006, 3:04 AM   #7
stevengs
Professional Programmer
 
stevengs's Avatar
 
Join Date: May 2005
Location: Bad Nauheim, Germany
Posts: 436
Rep Power: 4 stevengs is on a distinguished road
Quote:
Originally Posted by DaWei
Why don't you begin your beginneriness with something that clues you in a tad more than you are. Or, if you want someone to do your stuff FOR you, don't beat around the bush, just say so.
Exactly!

Quote:
Originally Posted by shadyi
..
i know it sounds crazy..
Change 'cr' to 'l'.
__________________
-Steven
"Is this a piece of your brain?" - Basil Fawlty
stevengs is offline   Reply With Quote
Old May 16th, 2006, 1:25 PM   #8
kruptof
Professional Programmer
 
kruptof's Avatar
 
Join Date: May 2006
Location: UK - London
Posts: 327
Rep Power: 3 kruptof is on a distinguished road
before you create a bootloader you have to understand that the bios looks for the value 0x55 in the 510 location of the device (which is a drive A) and 0xaa in the 511 location. here is the code to write a simple bootdisk in C but this is not very good because it just goes into the bootloader and comes straight out.

Here is the code
Quote:
#include <stdio.h>
#include <sys/types.h>
#include<unistd.h>
#include <fcntl.h>
int main(int argc, char *argv[])
{
char buffer[512];
int fhandle;
buffer[510]=0x55;
buffer[511]=0xaa;
fhandle=open("a:", O_RDWR);
lseek(fhandle,0,SEEK_CUR);
write(fhandle,buffer,512);
close(fhandle);
return 0;
}
for more in depth explaination please refer to Krishnakumar tutorial here is the link for his tutorial: http://linuxgazette.net/issue77/krishnakumar.html
kruptof is offline   Reply With Quote
Old May 16th, 2006, 3:54 PM   #9
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
There's a tab key reachable by your left pinky on most keyboards. Learning to use it wisely might induce more people to read your code. Just sayin'.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 20th, 2006, 4:56 PM   #10
linxis
Programmer
 
Join Date: May 2006
Location: USA
Posts: 52
Rep Power: 0 linxis has a little shameless behaviour in the past
Send a message via ICQ to linxis
Boot.ini

goto command prompt and type attrb -r -h -s boo.ini to make it editable and viewable.
linxis is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:32 AM.

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