Page 1 of 1

What next?

Posted: Thu Mar 03, 2005 8:35 am
by Tehy
Hi!

I have finally done some real code in my OS :) I only got this bootloader and I dont know what to do next. I hope someone could help me :)
[BITS 16]
[ORG 0x7C00]


main:
mov ax, 0x0000 ;Load ds register with current segment
mov ds, ax

mov si, String1 ;Write String1 to the screen
call PrintMsg

mov si, String2 ;Write String2 to the screen
call PrintMsg

jmp $


PrintMsg:
mov ah, 0x0E ;Teletype Mode
mov bh, 0x00 ;Page Number
.nextchar:
lodsb ;Load [si] into al and increment si
or al, al ;Set the Zero Flag if al = 0
jz .return ;If the Zero Flag is set, jump to Break
int 0x10 ;Call BIOS Video Function
jmp .nextchar ;Loop around to write next character
.return
ret ;Return


String1: db "Neg OS", 13, 10, 0
String2: db "Boot v.1.0", 0


times 510-($-$$) db 0 ;Loads of zeroes
dw 0xAA55 ;two last bytes

Re:What next?

Posted: Thu Mar 03, 2005 9:46 am
by Pype.Clicker
any chance that in what order should i make things in? help ?

usually, setting up an environment that provide basic memory management, display stuff and support IRQs will help.

You may want to have ProtectedMode too ...

Re:What next?

Posted: Thu Mar 03, 2005 3:19 pm
by Presumably a guest
Before you work on the things Pype mentioned, you'll probably want to provide the means to load something larger than 512 bytes (e.g. a file on a floppy) and transfer control to it, since I hardly believe you'll be able to do all the things you want to do in half a kilobyte.

Re:What next?

Posted: Fri Mar 04, 2005 8:25 am
by Poseidon
It may be handier to use in the beginning stage of your kernel a bootloader from someone else, I recommend GRUB. It supports lots of filesystems and a lot of executable formats as well.

Re:What next?

Posted: Fri Mar 04, 2005 9:27 am
by AR
Or more accurately, it supports ELF and has a hack to support almost any other executable format. I recommend GRUB as well but I learned a lot from messing with a bootloader before I switched to GRUB though.

Re:What next?

Posted: Sun Mar 06, 2005 11:02 am
by Tehy
Ok thanks for all :)

Re:What next?

Posted: Sat Mar 12, 2005 1:12 am
by Tehy
I decided start to use GRUB but I dont know how GRUB works. Can GRUB load my kernel in hardrive?

Re:What next?

Posted: Sat Mar 12, 2005 1:53 am
by AR
GRUB Documentation

You can also get an empty GRUB disk image from Pype's site (here - miscellaneous section)

Re:What next?

Posted: Sat Mar 12, 2005 5:47 am
by Pype.Clicker
Tehy wrote: I decided start to use GRUB but I dont know how GRUB works. Can GRUB load my kernel in hardrive?
sure it can! just tell what partition (e.g. hd0(2)) and what file in that partition et voil?. consider using the GRUB command line feature ...

It can even download the image from the network and boot it if asked politely enough ;)