1

I try to write a bootloader for a ext2 formatted drive. I loaded the superblock to 0x7e00. Then I determined the block size by reading 24th byte. I shifted 1024 left with this value. But the cl register contains the wrong value.

Memory dump (At 0x7e00 + 24 for 4 bytes):

24>: 0x02 0x00 0x00 0x00
Shifted value: 0x400 (eax)
cl: 0x00

My Code:

mov     eax, 1024
mov     cl, byte [0x7e00 + 24]
shl     eax, cl
mov     [BLOCK_SIZE], eax

What have I done wrong?

Xorda
  • 51
  • 4

1 Answers1

2

Solution: The problem was that I forgot my DS register. I changed the org directive to org 0x7c00 and set the segment registers to 0x0

Xorda
  • 51
  • 4