Bootloader

Hi all out there...
I have a littel problem, with bootloaders.
I have searched the internet, after a solution, but found nothing.
The problem is, when i try reading sector 2 (floppy drive), the code there is suposed to be there, is not there.
I use DEBUG.EXE to write to the vitual floppy drive, and BOCHS to test it.
When i use Debug.exe i type in:
w 100 0 0 1; for boot loader
q
then i load the next step in the boot process, and type the following in debug:
w 100 0 1 2; this should write to the second sector.
q
but when i debug using boch, the sector does not contain the code, that i wrote.

what is worng???
I have tried to change the bootloader, but with no luck.
I dont thing it is in the bootloader, and the process there load the second sector is:
[code]resetdrive:
xor dx,dx
xor ax,ax
int 0x13
jc resetdrive
mov ax,0x1000
mov es,ax
xor bx,bx

readdrive:
xor dx,dx
mov ax,0x0201
mov cx,0x0102
int 0x13
jc readdrive
jmp con[/code]

if someone can see the error, i will like to know, or if you have a better solution(i still want to load the second sector, not a file :) )[hr]

[hr]

KMT

Comments

  • : When i use Debug.exe i type in:
    : w 100 0 0 1; for boot loader
    : q
    : then i load the next step in the boot process, and type the
    : following in debug:
    : w 100 0 1 2; this should write to the second sector.
    : q
    :
    I think I see a couple problems here.
    Debug says:
    W [address] [drive] [first sector] [number]

    to me that would mean you're writing 2 sectors starting at sector 1.
    There are plenty of disk sector view/edit programs out there, I'd double check with one of those to see if your code is really sitting on sector #2.

    That help in debug is a little ambiguous.

    The next thing I see is the loading of the 2nd sector. You're loading CX with 0102h, which is going to read from track 1, sector 2, where you're hoping to have just sector 2 on track 0, if you want your next chunk of code to exist immediately after your bootsector.

    -jeff!
  • Thanks for so fast answed,
    i have just descovered, that it was not the lastest code,
    can you name some good tools, cause i need some.
    the "new" code is:
    [code]resetdrive:

    xor ax,ax
    int 0x13
    jc resetdrive
    xor ax,ax
    mov es,ax
    mov bx,0x1000

    read.:

    mov ah, 0x02 ; function 2
    mov al, 10 ; read 10 sectors
    mov ch, 1 ; we are reading the second sector past us, so its still on track 1
    mov cl, 1 ; sector to read (The second sector)
    mov dh, 0 ; head number
    mov dl, 0 ; drive number. Remember Drive 0 is floppy drive.
    int 0x13 ; call BIOS - Read the sector
    cmp ah,0x00
    jne read.
    jmp con [/code]
    and the "con":
    [code]con:
    mov ax,0xb800
    mov es,ax
    xor di,di
    mov si,conmsg
    call printstring
    jmp 0x0000:0x1000[/code]


    Thanks
  • : Thanks for so fast answed,
    : i have just descovered, that it was not the lastest code,
    : can you name some good tools, cause i need some.

    I always liked norton diskedit, but that's rather old and DOS based (but then so am I)

    you could try diskExplorer
    http://www.runtime.org/diskexplorer.htm#DE_FAT

    I suspect there are others. Anything that does sector viewing/editing should be of some assistance.

    -jeff!
  • Very much thanks to you jeff.
    i can see all i need with another hex editor, (HxD)


    KMT
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion