3b2: Support 'Write Track' floppy command

This commit is contained in:
Seth Morabito 2017-11-21 18:14:08 -08:00 committed by Mark Pizzolato
parent 243ee968fb
commit be48e5809b

View file

@ -85,8 +85,8 @@ DEVICE if_dev = {
}; };
IF_STATE if_state; IF_STATE if_state;
uint32 if_sec_ptr; uint32 if_sec_ptr = 0;
t_bool if_irq; t_bool if_irq = FALSE;
/* Function implementation */ /* Function implementation */
@ -425,7 +425,14 @@ void if_handle_command()
break; break;
case IF_WRITE_TRACK: case IF_WRITE_TRACK:
sim_debug(EXECUTE_MSG, &if_dev, "\tCOMMAND\t%02x\tWrite Track\n", if_state.cmd); sim_debug(EXECUTE_MSG, &if_dev, "\tCOMMAND\t%02x\tWrite Track\n", if_state.cmd);
assert(0); /* NOT YET IMPLEMENTED */ /* Set DRQ */
if_state.drq = TRUE;
if_state.status |= IF_DRQ;
if (if_state.cmd & IF_E_FLAG) {
if_activate(IF_W_DELAY + IF_VERIFY_DELAY + head_switch_delay);
} else {
if_activate(IF_W_DELAY + head_switch_delay);
}
break; break;
case IF_FORCE_INT: case IF_FORCE_INT:
sim_debug(EXECUTE_MSG, &if_dev, "\tCOMMAND\t%02x\tForce Interrupt\n", if_state.cmd); sim_debug(EXECUTE_MSG, &if_dev, "\tCOMMAND\t%02x\tForce Interrupt\n", if_state.cmd);
@ -481,19 +488,24 @@ void if_write(uint32 pa, uint32 val, size_t size)
sim_debug(WRITE_MSG, &if_dev, "\tDATA\t%02x\n", val); sim_debug(WRITE_MSG, &if_dev, "\tDATA\t%02x\n", val);
if (uptr->fileref == NULL || if ((uptr->flags & UNIT_ATT) == 0) {
((if_state.cmd & 0xf0) != IF_WRITE_SEC && /* Not attached */
(if_state.cmd & 0xf0) != IF_WRITE_SEC_M)) {
/* Not attached, or not a write command */
break; break;
} }
/* Find the right offset, and update the value. */ if ((if_state.cmd & 0xf0) == IF_WRITE_TRACK) {
pos = if_buf_offset(); /* We intentionally ignore WRITE TRACK data, because
fbuf[pos + if_sec_ptr++] = (uint8) val; * This is only used for low-level MFM formatting,
* which we do not emulate. */
} else if ((if_state.cmd & 0xf0) == IF_WRITE_SEC ||
(if_state.cmd & 0xf0) == IF_WRITE_SEC_M) {
/* Find the right offset, and update the value. */
pos = if_buf_offset();
fbuf[pos + if_sec_ptr++] = (uint8) val;
if (if_sec_ptr >= IF_SECTOR_SIZE) { if (if_sec_ptr >= IF_SECTOR_SIZE) {
if_sec_ptr = 0; if_sec_ptr = 0;
}
} }
break; break;