Okay so this should be funny for some of you but its my first shot at writing a kernel so...

This is the boot loader which works fine doing these:

1) nasm -f bin Boot.asm -o Boot.o
2) partcopy 0 200 -f0

  MOV    SI , Message

  JMP $

Message DB 'Kernel: Loaded.', 0Dh, 0Ah, 0

  OR      AL , AL
  JZ      DONE
  MOV    AH , 0EH
  INT    10H

  TIMES 512-($-$$) DB 0

The problem is that the boot loader works fine but when it is supposed to load the kernel from the disk nothing happens except that the floppy disk indicator light stays lit. Can anybody tell me what I am doing wrong, please?
Posted on 2007-01-04 02:40:28 by XCHG
At first glance, I don't see any problems with your code, except the "read again" label, which should be placed before the place where you initialize the parameters for int13h. Here's how I load stuff in my bootloader code:

                    push    0
                    _ALIGN 4, 090h, main ; align to 4 with 90s (NOP), relative to 'main' label.
nxtldtry:           mov     ax, cs
                    mov     cx, 2
                    mov     bx, ORIG+200h
                    mov     es, ax
                    xor     dx, dx
                    mov     ax, 0207h
                    int     13h
                    pop     ax
                    jnc     _boot2  ; load ok. contunue execution at '_boot2'
                    cmp     ax, 7   ; max number of load retries
                    jae     load_error
                    inc     ax
                    push    ax
                    cmp     ax, 4   ; load retry after which the drive should be reset
                    jnz     nxtldtry
                    xor     ax, ax
                    xor     dx, dx
                    int     13h
                    jmp     nxtldtry

This code tries to load 7 sectors (2-8) to location "cs:ORIG+200h". It performs 7 retries. After 4th try, it performs a 'drive reset'.

ORIG is set to 07c00h, and cs is 0, so it tries to load at 07e00h.

PS: I hope that this '16-bit kernel' is just a temporary code to test your bootloader and that you plan to write 32/64-bit kernel ^^
Posted on 2007-01-04 06:57:38 by ti_mo_n
Ok the problem was with the code segment I reckon. I changed the kernel's source and it worked okay:

Posted on 2007-01-05 10:33:04 by XCHG