Bona Fide OS Developer
View unanswered posts | View active topics It is currently Thu Mar 28, 2024 1:08 pm



Post new topic Reply to topic  [ 3 posts ] 
 ASM - Extending boot loader 
Author Message

Joined: Wed Feb 17, 2010 7:39 am
Posts: 2
Post 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.


Wed Feb 17, 2010 7:48 am
Profile

Joined: Mon Oct 26, 2009 2:33 pm
Posts: 38
Location: United Kingdom
Post 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.

_________________
Andy Esser
neogenix Broadcast


Wed Feb 17, 2010 3:53 pm
Profile

Joined: Wed Feb 17, 2010 7:39 am
Posts: 2
Post 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


Thu Feb 18, 2010 2:21 am
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 


Who is online

Users browsing this forum: No registered users and 23 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin and tweaked by the BF Team.