
I have done a bootsector that supports FAT12 and loads my kernel.bin.
Becasue the setting of pmode etc. don´t fit into the bootsector code i will do that in the kernel.
I have decided to put the kernel at FFFF:0010 (that i have read is at 1mb in the memory.)
So i have set the A20-gate in the bootloader so i don´t need to move the kernel later.
Now to the problem:
How do i write (in nasm) in the kernel so it will know it´s on FFFF:0010?
I tried all sorts of thing (stupid?) things but i can´t get it working!
I tried something like this (but with the correct address):
[ORG 0]
jmp 07C0h:start ; Goto segment 07C0
start:
; Update the segment registers
mov ax, cs
mov ds, ax
mov es, ax
And i have tried something like this:
[ORG 7C00h]
at the top of the kernel, but i just can´t get it working...
_and_ i have tried:
mov ax, 0x7C0
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
with no success... i have tried with diffrent addresses like:
0x0010 and 0xFFFF and 0x00100000(physical address to 1mb)
If i load the kernel to, say 0x0000:0x1000, it is no problem becasue than i can use the code above buy changing 0x7C0 to 0x1000.
So i guess that it dosen´t work becasue the segment isn´t 0x0000....
But i can access the address at 1mb (enable the A20-gate) without having to enter pmode first, right?
I _do_ really suck on memory things..
So do i write (in nasm) in the kernel so it will know it´s on FFFF:0010?
Thanks in advance
/ Christoffer