Kernel problem...

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.
Post Reply
platon

Kernel problem...

Post 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 ???
prabuinet

RE:Kernel problem...

Post by prabuinet »

may be, because of bad linkage.
Disassemble and check it out.(with ndisasm)
knicos

RE:Kernel problem...

Post 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'
pkd

RE:Kernel problem...

Post by pkd »

I think the problem is to do withn the fact that you are using

    16bit  dw for vid mem
E-mean

RE:Kernel problem...

Post by E-mean »

You should define as follow:
VideoMemory EQU 0xB8000
platon

RE:Kernel problem...

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