Just to let you guys know, I've finally slaughtered the Floppy disk read problem.
Somehow there was a flaw in the floppy driver, though I've changed so much it'd be impossible to say where.
I added lots of debug output to the floppy commands like SEEK and CALIBRATE, and found out it couldn't find the proper sector.
Now that it works, I'm going to try and see if I can get it to support multiple drives (let it detect which one's where, and adjust the settings automatically), and add the option of writing data to the disk.
EDIT: But now I've broken VirtualPC. Will have to find a way to make it work on both, but I'm glad it works on real hardware like it should.
Also, the dma_reset_flipflop routine is flawed; you only use 0, or 1 as input values, but in the function it returns if the parameter is less than 2.
It should be changed to return if the parameter is equal, or greater than 2
From:
Code: Select all
//! resets flipflop
void dma_reset_flipflop(int dma){
if (dma < 2) //this is wrong, since this way the rest of the function never executes
return;
//! it doesnt matter what is written to this register
outportb( (dma==0) ? DMA0_CLEARBYTE_FLIPFLOP_REG : DMA1_CLEARBYTE_FLIPFLOP_REG, 0xff);
}
To:
Code: Select all
//! resets flipflop
void dma_reset_flipflop(int dma){
if (dma >= 2) //this is correct
return;
//! it doesnt matter what is written to this register
outportb( (dma==0) ? DMA0_CLEARBYTE_FLIPFLOP_REG : DMA1_CLEARBYTE_FLIPFLOP_REG, 0xff);
}
Since you need to reset the flipflop for the entire thing to work