im trying to write a readsector function for my floppy driver and I keep running into a problem.
as soon as I execute the read command and send 0xFF to the floppy drive, VMWare reaches an unrecoverable error:
ASSERT F(553):1430 bugNr=3285
Bochs simply stops (I think it is just waiting on the interrupt which is not being sent).
here's my readsector code:
int fdc_ReadSector(int driveNum, unsigned long lba, char* buffer) {
unsigned char c, h, s, st0, st1, st2;
FDD* fdd = &drives[driveNum];
if(initialized == 0)
return 0;
if( driveNum >= MAXDRIVES )
return 0;
if( drives[driveNum].enabled == 0 )
return 0;
fdc_LBAToCHS(fdd, lba, &c, &h, &s);
fdc_StartDriveMotor(fdd);
cpu_Wait(100000);
//specify?
fdc_SeekDrive(fdd, c, h);
fdc_SendCommand(0xe6);
fdc_SendCommand( (h << 2) | fdd->driveNumber ); //drive # is 0
fdc_SendCommand(c);
fdc_SendCommand(h);
fdc_SendCommand(s);
fdc_SendCommand(fdd->sectorSizeCode); //2
fdc_SendCommand(fdd->numSectorsPerCylinder); //18
fdc_SendCommand(fdd->gapLengthCode); //27
fdc_SendCommand(0xFF);
//problem at this Send_Command
fdc_WaitForInterrupt();
st0 = fdc_GetResponse();
st1 = fdc_GetResponse();
st2 = fdc_GetResponse();
fdc_GetResponse(); //cylinder
fdc_GetResponse(); //head
fdc_GetResponse(); //sector
fdc_GetResponse(); //sector size
fdc_StopDriveMotor(fdd);
if( FDC_STATUS_SUCCESS(st0) )
return 1;
return 0;
}
I'm executing this on lba 0. The CHS converts correctly to c: 0, h: 0, s: 1.
My interrupt handling is very basic. It seems to work fine when I'm resetting and calibrating the drive:
static void fdc_WaitForInterrupt() {
while(irqStatus == 0);
irqStatus = 0;
}
static void fdc_IRQCallback() {
irqStatus = 1;
}
The last thing Bochs outputs in the log is:
00115020700d[FDD ] FLOPPY COMMAND:
00115020700d[FDD ] [e6]
00115020700d[FDD ] [00]
00115020700d[FDD ] [00]
00115020700d[FDD ] [00]
00115020700d[FDD ] [01]
00115020700d[FDD ] [02]
00115020700d[FDD ] [12]
00115020700d[FDD ] [1b]
00115020700d[FDD ] [ff]
00115020700d[FDD ] read/write normal data
00115020700d[FDD ] BEFORE
00115020700d[FDD ] drive = 0
00115020700d[FDD ] head = 0
00115020700d[FDD ] cylinder = 0
00115020700d[FDD ] sector = 1
00115020700d[FDD ] eot = 18
00115020700d[FDD ] io_write: diskette controller data
If anyone has any idea what I'm doing wrong, help would be greatly appreciated.
Thanks.
fdd driver
Re: fdd driver
nm i fixed it.
there was a problem in my DMA code. had nothing to do with this part.
sorry to bother.
there was a problem in my DMA code. had nothing to do with this part.
sorry to bother.
-
deathangel
- Member

- Posts: 31
- Joined: Thu Apr 14, 2005 11:00 pm
- Location: Planet Earth
- Contact:
Re: fdd driver
mk, could you send me your floppy source?