Page 1 of 1

Kernel problem...

Posted: Fri Jun 04, 2004 11:00 pm
by platon
Hello everybody :)

I've a problem with my kernel. My bootloader loads kernel it from FAT12 at address 0x80000, sets protected mode and all segment registers. Here's my (very simple) kernel :

[BITS 32]
[ORG 0x80000]

VideoMemory dw 0xB8000

_start:
   MOV [0xB8000], byte 'A'
   MOV [0xB8001], byte 0x07
   MOV [VideoMemory+2], byte 'B'
   MOV [VideoMemory+3], byte 0x07

kernel_end:  
   JMP kernel_end

The 'A' is displayed, but not the 'B'... why ???

RE:Kernel problem...

Posted: Fri Jun 04, 2004 11:00 pm
by prabuinet
may be, because of bad linkage.
Disassemble and check it out.(with ndisasm)

RE:Kernel problem...

Posted: Fri Jun 04, 2004 11:00 pm
by knicos
VideoMemory isn't a constant (immediate), its stored in memory. You have to move VideoMemory to a register first. At the moment it is moving 'B' to the address of VideoMemory (not 0xB8000, but 0x80000) + 2.

try:
MOV eax, [VideoMemory]
MOV [eax+2], byte 'B'

RE:Kernel problem...

Posted: Sat Jun 05, 2004 11:00 pm
by pkd
I think the problem is to do withn the fact that you are using

    16bit  dw for vid mem

RE:Kernel problem...

Posted: Mon Jun 07, 2004 11:00 pm
by E-mean
You should define as follow:
VideoMemory EQU 0xB8000

RE:Kernel problem...

Posted: Mon Jun 07, 2004 11:00 pm
by platon
First, thanks everybody 4 help !

Yes sure, it's work now, but...
I can't access other variables. When I put something like

MOV AL, 'A'
MOV [0xB8000], byte AL
MOV [0xB8001], 0x07

It doesn't print what I want... Very strange...Any idea ?