Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[BITS 16] ;Tells the assembler that its a 16 bit code
[ORG 0x7C00] ;Origin, tell the assembler that where the code will
;be in memory after it is been loaded
MOV AL, 65
CALL PrintCharacter
JMP $ ;Infinite loop, hang it here.
PrintCharacter: ;Procedure to print character on screen
;Assume that ASCII value is in register AL
MOV AH, 0x0E ;Tell BIOS that we need to print one charater on screen.
MOV BH, 0x00 ;Page no.
MOV BL, 0x07 ;Text attribute 0x07 is lightgrey font on black background
INT 0x10 ;Call video interrupt
RET ;Return to calling procedure
TIMES 510 - ($ - $$) db 0 ;Fill the rest of sector with 0
DW 0xAA55 ;Add boot signature at the end of bootloader
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
The problem is that all these examples are written for booting from floppy drive,
and my intention is to write basic boot loader for USB drive, so this is probably
reason why this code does not work for USB.
Does anybody have idea or experience with this ?
Last edited by JamesM on Wed Jan 05, 2011 7:59 am, edited 3 times in total.
Reason:Use code tags. Have you never used forum software before?
I just found one previous post that has similar subject and the code is also provided.
This code boot from CD and without FDD emulation, anyway code begin like this:
/***************************************************************/
/*
* Features:
* - supports ISO-9660 filesystem ("El Torito")
* - supports multiples burning session
* - no floppy emulation
*
* Limitations:
* - supports only Joliet format
*/
.text
.code16
.org 0
/*
* This is the main function of the boot sector, which loads the OS image
* into memory at 1000:0000.
*
* Parameters:
* DL = boot disk number.
*/
.global _start
_start:
cli
/* The BIOS has loaded our boot sector at 0000:7C00. We move the code
of this boot sector at 9000:0000. */
xorw %ax, %ax
movw %ax, %ds
movw $0x7C00, %si /* DS:SI = 0000:7C00. */
movw $0x9000, %ax
movw %ax, %es
xorw %di, %di /* ES:DI = 9000:0000. */
movw $0x0800, %cx /* 2048 bytes. */
rep
movsb /* do the relocation. */
/* Jump to the new address. */
ljmp $0x9000, $1f
/***************************************************************/
So it seems that jump address for floppy is 7000:0000 and for CD is 9000:0000
Does anybody know what is address for USB drive ?
Last edited by probe on Wed Jan 05, 2011 11:33 am, edited 2 times in total.
Please use code tags. On first read I couldn't tell if you were even asking a question or just dumping code for no reason.
As per your question, booting from USB is done by asking the BIOS to fake/emulate it as a floppy or hard drive. Different BIOSes require different things to be present. There's a number of threads floating around here detailing quirks people have encountered. I'll trust you can use forum search or google to find them.
There is also general information on the boot process in the wiki, and someone may have transcribed the USB booting quirks there. I haven't looked, though.
probe wrote:Why did you post here at all ?
This what you write is total zero.
Please write only if you have something connected to technical subject,
not things like "search on google" and "I can not read".
That was unnecessarily rude and confrontational. I asked you to conform to the rules of the community, and even pointed you in the right direction for your problem. What I posted was completely on topic.
Since you couldn't search the first time, I'll link you this time.
Linuxfood beat me to most of my point - it is very rude to complain to someone if you break three rules yourself (legibility, smart questions, search first)
The answer to your original question is "dl" by the way. I doubt if it's going to help you though. Ask a better question (as per above) for practice.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Hi, I am glad that you edited your post. Please cooperate. If you neglect the one who is trying to help you, it is likely that you will be neglected as well.
Regards,
Chandra
Programming is not about using a language to solve a problem, it's about using logic to find a solution !