Page 1 of 1

problem loading kernel

Posted: Tue Mar 09, 2004 11:09 am
by shaz
my kernel consists of almost 36k.
but it's not loading properly.
here is my code to load kernel.

Code: Select all

mov ax,0x0 
mov es,ax
mov bx, 0xB800          
mov ah,2                      
mov al,18                     
mov ch,7                      
mov cl,1                      
mov dh,0                      
int 0x13                      
jc error

mov ax,0x0 
mov es,ax
mov bx, 0xDC00          
mov ah,2                      
mov al,18                  
mov ch,8                      
mov cl,1                      
mov dh,0                      
int 0x13                      
jc error

mov ax,0x1000
mov es,ax
mov bx, 0x0          
mov ah,2                      
mov al,18                     
mov ch,9                      
mov cl,1                      
mov dh,0                      
int 0x13                      
jc error


mov ax,0x1000
mov es,ax
mov bx, 0x2400          
mov ah,2                      
mov al,18                     
mov ch,10                      
mov cl,1                      
mov dh,0                      
int 0x13                      
jc error



[\code]

the probelm occurs when i load 4th track.all tracks are loaded
properly cuz carry flag is not set.but i think something is wrong with loading addresses.
please tell me the problem and how to correct it. 




Re:problem loading kernel

Posted: Tue Mar 09, 2004 11:11 am
by Candy
some (read, lots) floppy controllers (bioses?) don't support >7 tracks per read. Split it up in 6-track reads. (guess of mine, happened to me too once)

Re:problem loading kernel

Posted: Tue Mar 09, 2004 12:28 pm
by Curufir
Well I took a look at the addresses and they seem fine.

The thing that gets me curious is that all of these reads take place on the same head. Unless you've got your own utility for writing the file out to disk that seems a very unusual way for it to be arranged.

Re:problem loading kernel

Posted: Tue Mar 09, 2004 12:36 pm
by shaz
another strange thing happend when i limited the size of my kernel to less than 3 tracks.
now if i still read the 4th track (although it contains nothing) to above mentioned address .pc just halts.but if i change the loading address to something else,everything works fine.

Re:problem loading kernel

Posted: Tue Mar 09, 2004 1:02 pm
by Neo
if anyone knows of a good site having pics of a floppys layout of tracks sectors etc with numbering as well as a good explanation it would be helpful for me to include in my docs.

Re:problem loading kernel

Posted: Tue Mar 09, 2004 1:26 pm
by Pype.Clicker
keep in mind that the DMA transfers may not cross a 64KB boundary. This means that a transfer that starts with X = N*65536+M can only go up to N*65536+65535 ...

I don't know if the BIOS can split the transfer in two DMA request or not, but i wouldn't count on it. The BIOS doesn't allows more than 64KB to be transferred at once, iirc that makes about 7 tracks of 18 sectors

Re:problem loading kernel

Posted: Wed Mar 10, 2004 11:14 am
by Neo
Ive seen that most of you use the default values for sectors/track, heads, bytes/sector etc... what i want to know is how can this work if i change the floppy or drive etc..?
How can we obtain the actual values of these parameters? Should we get it from the bootloader? if so what happens when we boot from a hard-disk? wont the bootloader just give us the same defaults we use?
Suppose during run-time we use a differently formatted(diff params) floppy? (or is this a dumb question?)
Yeah thats a lot of questions. Any answers?

Re:problem loading kernel

Posted: Wed Mar 10, 2004 11:43 am
by Candy
Neo wrote: Ive seen that most of you use the default values for sectors/track, heads, bytes/sector etc... what i want to know is how can this work if i change the floppy or drive etc..?
Not.
How can we obtain the actual values of these parameters?
The Bios Data Area has some info, and the floppy itself (with FAT12) has some.
Should we get it from the bootloader?
Don't you make the bootloader? Or at least, decide?
if so what happens when we boot from a hard-disk? wont the bootloader just give us the same defaults we use?
N/A, and the BDA is adjusted.
Suppose during run-time we use a differently formatted(diff params) floppy? (or is this a dumb question?)
There are no dumb questions :P

You code a different bootloader for the floppies that are different. Or, you probe the sectorcount.

Re:problem loading kernel

Posted: Wed Mar 10, 2004 12:57 pm
by Neo
Candy wrote: You code a different bootloader for the floppies that are different. Or, you probe the sectorcount.
do you mean keep testing the sectors until we fault??

Re:problem loading kernel

Posted: Wed Mar 10, 2004 1:15 pm
by Candy
Neo wrote:
Candy wrote: You code a different bootloader for the floppies that are different. Or, you probe the sectorcount.
do you mean keep testing the sectors until we fault??
Try to read sector 36, if it doesn't exist the floppy has less than 36 sectors. Try to read sector 18, if it doesn't exist .... sector 9, if it doesn't exist ... sector 6 ... ?

get the point?