This is a personal project of mine. I am currently in the research phase of developing my own bootloader that will be used to load a single task operating system. I am far away from the final goal, but have been trying to document my process as a reference. The content of my code documentation and code can be found at Bootloader 101.
If possible I would appreciate feedback. The wiki page is open to be edited, and if you feel like you can contribute please feel free to do so. I apologize beforehand for referencing you to another page. The format of the content is important.
First piece of code:
# Author: Matthew Hoggan
# Date Created: Tuesday, Mar 6, 2012
.code16 # Tell assembler to work in 16 bit mode (directive)
.section .text
.globl _start # Help linker find start of program
_start:
movb $0x0e, %ah # Function to print a character to the screen
movb $0x00, %bh # Indicate the page number
movb $0x07, %bl # Text attribute
mov $'A', %al # Move data into low nibble
int $0x10 # Video Service Request to Bios
_hang:
jmp _hang
.end
/* linker.ld */
SECTIONS
{
/* Set location counter to 0x7c00 */
. = 0x7c00;
.text : { *(.text) }
.data : { *(.data) }
.other :
{
FILL(0x000000)
. = 0x1F2;
BYTE(0x55)
BYTE(0xAA)
}
}
Second piece of code:
# Author: Susam Pal <http://susam.in/>
.code16 # Tell the assembler to use 16 bit instructions
.section .text
.globl _start
_start: # Tell linker where entry point into program is
mov $0xb800, %ax # 0xb800 is the start address of character buffer
mov %ax, %ds # Move that address into the data segment
movb $'B', %ds:0x00 # Write data directly to that buffer at 0
movb $0x1e, %ds:0x01 # Write text attributes for the text right after
idle:
jmp idle
/* linker.ld */
SECTIONS
{
/* Set location counter to 0x7c00 */
. = 0x7c00;
.text : { *(.text) }
.data : { *(.data) }
.other :
{
FILL(0x000000)
. = 0x1ED;
BYTE(0x55)
BYTE(0xAA)
}
}