{ 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15, 4, 8, 12, 16 },
};
-static uint8_t live[4];
+static uint8_t live[4] = { 0xFF, 0xFF, 0xFF, 0xFF};
/*
* A note on disk formats and the Cromenco (and also emulator limits)
* Just to get us going - only do DSDD.
*/
+
static int fd_transfer(uint8_t minor, bool is_read, uint8_t rawflag)
{
int8_t tries;
uint8_t trackno, sector;
uint8_t large = !(minor & 0x10);
const uint8_t *skew = skewtab[large]; /* skew table */
+ uint16_t ct = 0;
if(rawflag == 2)
goto bad2;
if (rawflag && d_blkoff(BLKSHIFT))
return -1;
-
/* Command to go to the controller after any seek is done */
fd_cmd[0] = is_read ? FD_READ : FD_WRITE;
/* Control byte: autowait, DD, motor, 5", drive bit */
fd_cmd[1] = 0xE0 | selmap[drive];
if (large)
- fd_cmd[1] = 0x10; /* turn on 8" bit */
+ fd_cmd[1] |= 0x10; /* turn on 8" bit */
/* Directon of xfer */
fd_cmd[2] = is_read ? OPDIR_READ: OPDIR_WRITE;
fd_cmd[5] = 0x10 | delay[drive];
/*
* Begin transfers
*/
- while (udata.u_done < udata.u_nblock) {
+ while (ct < udata.u_nblock) {
/* Need to consider SS v DS here */
if (large) {
- fd_aux = 0x4C | (udata.u_block & 16) ? 2 : 0;
+ fd_aux = 0x4C | ((udata.u_block & 16) ? 0 : 2) ;
trackno = udata.u_block / 32;
sector = udata.u_block % 16;
} else {
sector = udata.u_block % 20;
if (sector > 9) {
sector -= 10;
- fd_aux = 0x5E; /* side 1 */
+ fd_aux = 0x5C; /* side 1 */
} else
- fd_aux = 0x5C;
+ fd_aux = 0x5E;
}
/* Buffer */
fd_cmd[3] = ((uint16_t)udata.u_dptr) & 0xFF;
for (tries = 0; tries < 4 ; tries++) {
(void)fd_data;
- fd_sector = skew[sector]; /* Also makes 1 based */
+ fd_sector = sector+1;/*FIXME/skew[sector]; /* Also makes 1 based */
if (fd_track != trackno) {
fd_data = trackno;
if (fd_seek()) {
if (tries == 4)
goto bad;
udata.u_block++;
- udata.u_done++;
+ udata.u_dptr += 512;
+ ct++;
}
/* Save the track */
track[drive] = fd_track;
- return udata.u_done << 9;
+ return ct << 9;
bad:
track[drive] = fd_track;
kprintf("fd%d: error %x\n", minor, err);
uint8_t *dp = live + (minor & 3);
flag;
- if ((minor & 0xE0) || drivetype[minor] == 255) {
+
+ if ((minor & 0xE0) || drivetype[minor & 3] == 255) {
udata.u_error = ENODEV;
return -1;
}