I give up.
I was really hoping that I wouldn't need to ask for help until at least I started the kernel... but apperarantly, I would...
So...
Code: Select all
;.
[BITS 16]
[ORG 0x100]
start:
jmp go
display_text:
mov bl,0x07
mov ah,0x0E
mov bh,0x00
.ch_loop:
lodsb
or al,al
jz .ch_done
int 0x10
jmp .ch_loop
.ch_done
ret
BootMsg: db "Second stage loaded",10,0
PModeMsg: db "Starting Protected Mode",13,0
align 8
gdt: dw 0x0017
dd 0x7C00+gdt
dw 0x0000
dw 0xFFFF,0x0000,0x9A00,0x00CF
dw 0xFFFF,0x0000,0x9200,0x00CF
go:
;Set variables and the stack
cli
mov bl,0x07
mov ds,ax
mov es,ax
mov ss,ax
mov sp,0x500
sti
mov si,BootMsg
call display_text
mov si,PModeMsg
call display_text
cli
cld
in al,0x92
or al,2
out 0x80,al
out 0x92,al
lgdt [gdt]
mov eax,cr0
or al,1
mov cr0,eax
jmp start:contin
contin:
[BITS 32]
mov eax,10h
mov es,eax
mov ds,eax
mov ss,eax
mov esp,0x7C00
jmp $
It all works great. Until I try to set Pmode.
That's when it all breaks down.
I've been looking through tons of examples and tutorials, but since I could never find any that explained the theory behind it. I have no idea if for example 0x10 is right to load into the variables and stuff...
Any suggestions are appreciated. (to what I should do with this code that is) (to make it work the way I want it that is)