Bona Fide OS Development
http://forums.osdever.net/

ASM - Extending boot loader
http://forums.osdever.net/viewtopic.php?f=5&t=177
Page 1 of 1

Author:  salehhamadeh [ Wed Feb 17, 2010 7:48 am ]
Post subject:  ASM - Extending boot loader

Dear Bona Fide Users,
I want to make a bootable program and the 512 limits of the bootloader aren't enough for me. I don't want to use any DOS commands; all what I want is the BIOS commands. Here is my code:
Code:
[BITS 16] ;Bits
[ORG 0x7C00] ;Origin

jmp 0x7E00 ;Jump to the offset directly after the boot sector

times 510 - ($ - $$) db 0 ;Fill the boot sector with 0x00s
dw 0xAA55 ;Boot Signature

mov al, 65 ;ASCII letter for 'A'
mov ah, 0x0e ;Print one character on the screen in TTY mode
mov bl, 0x07 ;FG: Grey  BG:Black
mov bh, 0x00 ;Page number

int 10h ;Video Interrupt

jmp $ ;Infinite loop


BTW, I'm using the Netwide Assembler(NASM) on Ubuntu Karmic.

Author:  AndyEsser [ Wed Feb 17, 2010 3:53 pm ]
Post subject:  Re: ASM - Extending boot loader

The common thing to do here is to simply have the 512 byte Boot Sector load your actual boot loader into memory and execute. Such a 2nd Stage boot loader can be any size you wish. If you write it to your bootable floppy or whatever as sectors, 1,2,3,4 (with your boot sector being 0). Then all your first 512 bytes has to load those 4 bytes into memory and jmp to that memory address. You can then have your 2nd stage boot loader doing more complicated things, like switching into Protected Mode etc.

Author:  salehhamadeh [ Thu Feb 18, 2010 2:21 am ]
Post subject:  Re: ASM - Extending boot loader

AndyEsser wrote:
The common thing to do here is to simply have the 512 byte Boot Sector load your actual boot loader into memory and execute. Such a 2nd Stage boot loader can be any size you wish. If you write it to your bootable floppy or whatever as sectors, 1,2,3,4 (with your boot sector being 0). Then all your first 512 bytes has to load those 4 bytes into memory and jmp to that memory address. You can then have your 2nd stage boot loader doing more complicated things, like switching into Protected Mode etc.


Thanks Andy. I think I knew what's the problem. It might be because I'm using a usb thumb drive to load my program. Can you please give me an example(in code) that let's me go to the 2nd stage of the boot loader from the usb thumb drive. Thanks for help :D

Page 1 of 1 All times are UTC - 6 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/