Lines 1497-1503
static uint32_t fdctrl_read_data(FDCtrl *fdctrl)
Link Here
|
1497 |
{ |
1497 |
{ |
1498 |
FDrive *cur_drv; |
1498 |
FDrive *cur_drv; |
1499 |
uint32_t retval = 0; |
1499 |
uint32_t retval = 0; |
1500 |
int pos; |
1500 |
uint32_t pos; |
1501 |
|
1501 |
|
1502 |
cur_drv = get_cur_drv(fdctrl); |
1502 |
cur_drv = get_cur_drv(fdctrl); |
1503 |
fdctrl->dsr &= ~FD_DSR_PWRDOWN; |
1503 |
fdctrl->dsr &= ~FD_DSR_PWRDOWN; |
Lines 1506-1513
static uint32_t fdctrl_read_data(FDCtrl *fdctrl)
Link Here
|
1506 |
return 0; |
1506 |
return 0; |
1507 |
} |
1507 |
} |
1508 |
pos = fdctrl->data_pos; |
1508 |
pos = fdctrl->data_pos; |
|
|
1509 |
pos %= FD_SECTOR_LEN; |
1509 |
if (fdctrl->msr & FD_MSR_NONDMA) { |
1510 |
if (fdctrl->msr & FD_MSR_NONDMA) { |
1510 |
pos %= FD_SECTOR_LEN; |
|
|
1511 |
if (pos == 0) { |
1511 |
if (pos == 0) { |
1512 |
if (fdctrl->data_pos != 0) |
1512 |
if (fdctrl->data_pos != 0) |
1513 |
if (!fdctrl_seek_to_next_sect(fdctrl, cur_drv)) { |
1513 |
if (!fdctrl_seek_to_next_sect(fdctrl, cur_drv)) { |
Lines 1852-1861
static void fdctrl_handle_option(FDCtrl *fdctrl, int direction)
Link Here
|
1852 |
static void fdctrl_handle_drive_specification_command(FDCtrl *fdctrl, int direction) |
1852 |
static void fdctrl_handle_drive_specification_command(FDCtrl *fdctrl, int direction) |
1853 |
{ |
1853 |
{ |
1854 |
FDrive *cur_drv = get_cur_drv(fdctrl); |
1854 |
FDrive *cur_drv = get_cur_drv(fdctrl); |
|
|
1855 |
uint32_t pos; |
1855 |
|
1856 |
|
1856 |
if (fdctrl->fifo[fdctrl->data_pos - 1] & 0x80) { |
1857 |
pos = fdctrl->data_pos - 1; |
|
|
1858 |
pos %= FD_SECTOR_LEN; |
1859 |
if (fdctrl->fifo[pos] & 0x80) { |
1857 |
/* Command parameters done */ |
1860 |
/* Command parameters done */ |
1858 |
if (fdctrl->fifo[fdctrl->data_pos - 1] & 0x40) { |
1861 |
if (fdctrl->fifo[pos] & 0x40) { |
1859 |
fdctrl->fifo[0] = fdctrl->fifo[1]; |
1862 |
fdctrl->fifo[0] = fdctrl->fifo[1]; |
1860 |
fdctrl->fifo[2] = 0; |
1863 |
fdctrl->fifo[2] = 0; |
1861 |
fdctrl->fifo[3] = 0; |
1864 |
fdctrl->fifo[3] = 0; |
Lines 1955-1961
static uint8_t command_to_handler[256];
Link Here
|
1955 |
static void fdctrl_write_data(FDCtrl *fdctrl, uint32_t value) |
1958 |
static void fdctrl_write_data(FDCtrl *fdctrl, uint32_t value) |
1956 |
{ |
1959 |
{ |
1957 |
FDrive *cur_drv; |
1960 |
FDrive *cur_drv; |
1958 |
int pos; |
1961 |
uint32_t pos; |
1959 |
|
1962 |
|
1960 |
/* Reset mode */ |
1963 |
/* Reset mode */ |
1961 |
if (!(fdctrl->dor & FD_DOR_nRESET)) { |
1964 |
if (!(fdctrl->dor & FD_DOR_nRESET)) { |
Lines 2004-2010
static void fdctrl_write_data(FDCtrl *fdctrl, uint32_t value)
Link Here
|
2004 |
} |
2007 |
} |
2005 |
|
2008 |
|
2006 |
FLOPPY_DPRINTF("%s: %02x\n", __func__, value); |
2009 |
FLOPPY_DPRINTF("%s: %02x\n", __func__, value); |
2007 |
fdctrl->fifo[fdctrl->data_pos++] = value; |
2010 |
pos = fdctrl->data_pos++; |
|
|
2011 |
pos %= FD_SECTOR_LEN; |
2012 |
fdctrl->fifo[pos] = value; |
2008 |
if (fdctrl->data_pos == fdctrl->data_len) { |
2013 |
if (fdctrl->data_pos == fdctrl->data_len) { |
2009 |
/* We now have all parameters |
2014 |
/* We now have all parameters |
2010 |
* and will be able to treat the command |
2015 |
* and will be able to treat the command |