Bugs on bootloader
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Bugs on bootloader
* A20: the code looks correct.
* LoadSectors: i can envision a problem if 'jc .error' is taken: since you don't reset AX to a value, you'll be actually re-using the "error status" that comes out of INT13 as command in the next iteration. beware!
Can you be more precise than "it doesn't work" like
- it at least goes until step XXX because i see NN dots on screen
- if XXX had worked, i should see YYY but it doesn't.
If possible, run your code in Bochs, with debug enabled and show us what BOCHS tells you ...
* LoadSectors: i can envision a problem if 'jc .error' is taken: since you don't reset AX to a value, you'll be actually re-using the "error status" that comes out of INT13 as command in the next iteration. beware!
Can you be more precise than "it doesn't work" like
- it at least goes until step XXX because i see NN dots on screen
- if XXX had worked, i should see YYY but it doesn't.
If possible, run your code in Bochs, with debug enabled and show us what BOCHS tells you ...
Re:Bugs on bootloader
Hmm. Maybe i don't understand something.
I changed the source to this
But When it writes me initializing, it restarts my pc.
How to enable debuging mode in bochs, because im new to it?
I changed the source to this
Code: Select all
<...>
SectorLoader:
mov ah, 0x02
mov al, 0x02
mov ch, 0x00
mov cl, 0x02
mov dh, 0x00
mov dl, [bootDrive]
mov bx, 60000
mov es, bx
mov bx, 00000
jmp .readsector
.error
mov si, msgErrorSector
call Print
.readsector
int 13h
jc .error
mov si, msgDot
call Print
.end
ret
<...>
msgInit db "Initializing",0
msgDot db ".",0
msgErrorSector db "Can't read sector",0
bootDrive db 0
<...>
How to enable debuging mode in bochs, because im new to it?
Re:Bugs on bootloader
I found how to run bochs with debug(bochsdbg.exe).
It writes me that:
Next at t=0
(0) context not implemented because BX_HAVE_HASH_MAP=0
[0x000ffff0] f000:fff0 (unk. ctxt): jmp f000:e05b ; ea5be000f0
<bochs:1>
It writes me that:
Next at t=0
(0) context not implemented because BX_HAVE_HASH_MAP=0
[0x000ffff0] f000:fff0 (unk. ctxt): jmp f000:e05b ; ea5be000f0
<bochs:1>
Re:Bugs on bootloader
One thing that may be causing problems is the null GDT entry
gdt_null:
dd 0
should be change to
gdt_null:
dd 0
dd 0
each entry must be eight bytes
hope this helps
pkd
gdt_null:
dd 0
should be change to
gdt_null:
dd 0
dd 0
each entry must be eight bytes
hope this helps
pkd
Re:Bugs on bootloader
It still restarts me the PC when i try it on Real PC. Bochs too restarts and runs again that.
Re:Bugs on bootloader
Now is fixed some problems and it doesn't restart my PC. It writes now just "Initializing." with one dot. That means that A20 is enabled, I think. So maybe there is a problem with SectorLoader. But if there would be a problem, it would write an error that is programmed to do if it can't load sectors. It doesn't write that error. So I think that the bug is earlier than that the .error . My kernel.bin that is in second sector size is 784 bytes. Maybe there is a problem that it loads too much sectors. Please help me with these problems.
Re:Bugs on bootloader
BTW: I uploaded my bootloader source to the internet - http://avnet.sytes.net/~vladas/boot.asm .
I think it would be needed fixing that problem.
I think it would be needed fixing that problem.
Re:Bugs on bootloader
Yes, I found one bug, and now it writes me "Can't read sector".
I uploaded new source.
Bad that it still doesn't work good. Do someone knows a bug here?
I uploaded new source.
Bad that it still doesn't work good. Do someone knows a bug here?
Re:Bugs on bootloader
Hi,
Now, how many sectors do you have per track? A standard 1440 Kb floppy has 18, but you're trying to read from sector 2 to sector 21...
BTW it is possible to have 21 sectors per track (a 1680 Kb floppy), but it's not standard or as reliable..
Also you should try it 3 times before giving an error - from Ralph Brown's Interrupt List:
"errors on a floppy may be due to the motor failing to spin up quickly enough; the read should be retried at least three times, resetting the disk with AH=00h between attempts"
Cheers,
Brendan
Comments are good! For example:Vladaz wrote: Yes, I found one bug, and now it writes me "Can't read sector".
I uploaded new source.
Bad that it still doesn't work good. Do someone knows a bug here?
Code: Select all
mov ah, 0x02 ;ah = function 0x02, read sectors
mov al, 0x14 ;al = number of sectors to read
mov ch, 0x00 ;ch = cylinder (low 8 bits)
mov cl, 0x02 ;cl = starting sector number
mov dh, 0x00 ;dh = head number
BTW it is possible to have 21 sectors per track (a 1680 Kb floppy), but it's not standard or as reliable..
Also you should try it 3 times before giving an error - from Ralph Brown's Interrupt List:
"errors on a floppy may be due to the motor failing to spin up quickly enough; the read should be retried at least three times, resetting the disk with AH=00h between attempts"
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re:Bugs on bootloader
When it was mov al, 0x14 it flooded me with "Can't read sector" messages. When i changes to mov al, 0x08 it didn't wrote me that messege, but it restarted when second dot appeared. I am using a standard 1440 Kb floppy, my kernel size is 784 bytes if this info is needed. I am using now Bochs. Now I think that it maybe can't load PMode or something.
Re:Bugs on bootloader
Hi,
I took another look - this code:
.should be replaced with:
Apart from that it worked properly for me using Bochs, although I did comment out the final "jmp 60000" because I didn't have a kernel.
Cheers,
Brendan
I took another look - this code:
Code: Select all
gdt_desc:
db gdt_end - gdt
dw gdt
Code: Select all
gdt_desc:
dw gdt_end - gdt
dd gdt
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re:Bugs on bootloader
I have replaced these lines. If i comment jmp 60000 then it doesn't restarts. I've put the code that would work in PMode. That code must write "a" to the screen, but it won't do that.
The Bootloader source - http://avnet.sytes.net/~vladas/boot.asm
Kernel source if needed - http://avnet.sytes.net/~vladas/kernel.zip
I uploaded to net kernel source, because in kernel can be a problem, so if someone can and have some time, please take a look at it. Thanks
The Bootloader source - http://avnet.sytes.net/~vladas/boot.asm
Kernel source if needed - http://avnet.sytes.net/~vladas/kernel.zip
I uploaded to net kernel source, because in kernel can be a problem, so if someone can and have some time, please take a look at it. Thanks
Re:Bugs on bootloader
Sorry:) The "a" is wrote in the corner top left. Just I didn't saw. So there I think will be problems with kernel or SectorLoader.