L0 & WTF can someone help me?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
SoulofDeity
Member
Member
Posts: 193
Joined: Wed Jan 11, 2012 6:10 pm

Re: L0 & WTF can someone help me?

Post 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. :(
User avatar
DavidCooper
Member
Member
Posts: 1150
Joined: Wed Oct 27, 2010 4:53 pm
Location: Scotland

Re: L0 & WTF can someone help me?

Post 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.
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming
SoulofDeity
Member
Member
Posts: 193
Joined: Wed Jan 11, 2012 6:10 pm

Re: L0 & WTF can someone help me?

Post 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!
Post Reply