Page 2 of 2

Re: L0 & WTF can someone help me?

Posted: Sun Jul 15, 2012 3:44 pm
by SoulofDeity
egos wrote:What asm compiler do you use? If it's fasm then "equ" defines a symbolic constants, not numeric. You can use "=" or "label" instead.

Code: Select all

GDT:
        dq 0

        set KCODE,$-GDT ; label KCODE at $-GDT
        desc 0,0FFFFFh,DF_CODE32

        set KDATA,$-GDT
        desc 0,0FFFFFh,DF_DATA32

        set GDT_SIZE,$-GDT
Yeah, I used to use TASM, so that became a habit.
egos wrote:You didn't consider DLBuunk's and DavidCooper's remarks.

Because location of your kernel exceeds 0xFFFF and you use FLAT segments you should reset address counter using org directive.

Code: Select all

  jmp fword KCODE:@f ; "fword" allows to generate 32-bit instruction

  org $+10000h
  use32

@@:
  mov eax,KDATA
  mov ds,ax
  mov es,ax
  mov fs,ax
  mov gs,ax
  mov ss,ax
  mov esp,10000h

  mov word [0B8000h],"A" + 700h
  jmp $
Thanks! I completely overlooked that, but it still fails to work. I just don't understand why I'm having such a hard time with something this simple. :(

Re: L0 & WTF can someone help me?

Posted: Mon Jul 16, 2012 1:40 pm
by DavidCooper
How about posting your code as it is now so that everyone can get a clear idea of the changes you've made. If you know how to, get your assembler to show all the hex values as well so that it's absolutely clear how it's interpreting your code.

Re: L0 & WTF can someone help me?

Posted: Sat Jul 21, 2012 4:32 am
by SoulofDeity
DavidCooper wrote:How about posting your code as it is now so that everyone can get a clear idea of the changes you've made. If you know how to, get your assembler to show all the hex values as well so that it's absolutely clear how it's interpreting your code.
I already have once; but instead, can you (or anyone) post the code for a working example? I don't need a complete bootloader, just the part for setting up the gdt and entering pmode. I've been stuck on this for almost a year and I really just wanna get past it.

EDIT:

I just tried it again and dumped the GDT with the VB debugger, and managed to figure it out myself :D

Turns out I was forgetting to add 0x10000 to the linear address of the gdt. I can't believe it took me this long to notice that! :|
A well, problem solved!