
in main(...) after successful reading of data
Code: Select all
/// //////////////////////// TEST FLOPPY DRIVER
flpydsk_set_working_drive(0); // set drive 0 as current drive
flpydsk_install(6); // floppy disk uses IRQ 6
int retVal = flpydsk_write_sector(1); // should be start of FAT1?
printformat("\nReturn Value of Write Sector: %d\n", retVal);
/// //////////////////////// TEST FLOPPY DRIVER
Code: Select all
// write a sector
void flpydsk_write_sector_imp(unsigned char head, unsigned char track, unsigned char sector)
{
ULONG st0, cyl;
flpydsk_dma_write(); printformat("!"); // set the DMA for write transfer
flpydsk_send_command(FDC_CMD_WRITE_SECT | FDC_CMD_EXT_MULTITRACK | FDC_CMD_EXT_DENSITY ); // write a sector
flpydsk_send_command(head << 2 | _CurrentDrive );
flpydsk_send_command(track);
flpydsk_send_command(head);
flpydsk_send_command(sector);
flpydsk_send_command(FLPYDSK_SECTOR_DTL_512 );
flpydsk_send_command(( ( sector + 1 ) >= FLPY_SECTORS_PER_TRACK ) ? FLPY_SECTORS_PER_TRACK : sector + 1 );
flpydsk_send_command(FLPYDSK_GAP3_LENGTH_3_5 );
flpydsk_send_command(0xFF);
flpydsk_wait_irq();
int j;
for(j=0; j<7; ++j)
flpydsk_read_data(); // read status info
flpydsk_check_int(&st0,&cyl); // let FDC know we handled interrupt
}
// write a sector
int flpydsk_write_sector(int sectorLBA)
{
if (_CurrentDrive >= 4) return -1;
// convert LBA sector to CHS
int head=0, track=0, sector=1;
flpydsk_lba_to_chs(sectorLBA, &head, &track, §or);
// turn motor on and seek to track
flpydsk_control_motor(TRUE);
if(flpydsk_seek (track, head)) return -2;
// write sector and turn motor off
flpydsk_write_sector_imp(head, track, sector);
flpydsk_control_motor(FALSE);
return 0;
}

Is that o.k.?
flpydsk_send_command(FDC_CMD_WRITE_SECT | FDC_CMD_EXT_MULTITRACK | FDC_CMD_EXT_DENSITY );
EDIT: yes, it is!