void pc1512_state::set_fdc_dsr(UINT8 data) { /* bit description 0 Drive Select Bit 0 (DS0) 1 Drive Select Bit 1 (DS1) 2 765A reset 3 Allow 765A FDC to interrupt and request DMA 4 Switch motor(s) on and enable drive 0 selection 5 Switch motor(s) on and enable drive 1 selection 6 7 */ m_fdc_dsr = data; m_nden = BIT(data, 3); update_fdc_int(); update_fdc_drq(); update_fdc_tc(); upd765_reset_w(m_fdc, BIT(data, 2)); floppy_mon_w(m_floppy0, BIT(data, 4) ? CLEAR_LINE : ASSERT_LINE); floppy_mon_w(m_floppy1, BIT(data, 5) ? CLEAR_LINE : ASSERT_LINE); }
void luxor_55_21046_device::device_reset() { m_cs = false; floppy_mon_w(m_image0, ASSERT_LINE); floppy_mon_w(m_image1, ASSERT_LINE); floppy_drive_set_ready_state(m_image0, 1, 1); floppy_drive_set_ready_state(m_image1, 1, 1); }
void bw12_state::floppy_motor_off() { floppy_mon_w(m_floppy0, ASSERT_LINE); floppy_mon_w(m_floppy1, ASSERT_LINE); floppy_drive_set_ready_state(m_floppy0, 0, 0); floppy_drive_set_ready_state(m_floppy1, 0, 0); m_motor_on = 0; }
void bw12_state::ls259_w(int address, int data) { switch (address) { case 0: /* LS138 A0 */ m_bank = (m_bank & 0x02) | data; bankswitch(); break; case 1: /* LS138 A1 */ m_bank = (data << 1) | (m_bank & 0x01); bankswitch(); break; case 2: /* not connected */ break; case 3: /* _INIT */ break; case 4: /* CAP LOCK */ output_set_led_value(0, data); break; case 5: /* MOTOR 0 */ m_motor0 = data; if (data) { floppy_mon_w(m_floppy0, CLEAR_LINE); floppy_drive_set_ready_state(m_floppy0, 1, 0); } set_floppy_motor_off_timer(); break; case 6: /* MOTOR 1 */ m_motor1 = data; if (data) { floppy_mon_w(m_floppy1, CLEAR_LINE); floppy_drive_set_ready_state(m_floppy1, 1, 0); } set_floppy_motor_off_timer(); break; case 7: /* FDC TC */ upd765_tc_w(m_fdc, data); break; } }
static WRITE8_HANDLER(elwro800jr_fdc_control_w) { device_t *fdc = space->machine().device("upd765"); floppy_mon_w(floppy_get_device(space->machine(), 0), !BIT(data, 0)); floppy_mon_w(floppy_get_device(space->machine(), 1), !BIT(data, 1)); floppy_drive_set_ready_state(floppy_get_device(space->machine(), 0), 1,1); floppy_drive_set_ready_state(floppy_get_device(space->machine(), 1), 1,1); upd765_tc_w(fdc, data & 0x04); upd765_reset_w(fdc, !(data & 0x08)); }
void coco_fdc_device::dskreg_w(UINT8 data) { UINT8 drive = 0; UINT8 head = 0; if (LOG_FDC) { logerror("fdc_coco_dskreg_w(): %c%c%c%c%c%c%c%c ($%02x)\n", data & 0x80 ? 'H' : 'h', data & 0x40 ? '3' : '.', data & 0x20 ? 'D' : 'S', data & 0x10 ? 'P' : 'p', data & 0x08 ? 'M' : 'm', data & 0x04 ? '2' : '.', data & 0x02 ? '1' : '.', data & 0x01 ? '0' : '.', data); } /* An email from John Kowalski informed me that if the DS3 is * high, and one of the other drive bits is selected (DS0-DS2), then the * second side of DS0, DS1, or DS2 is selected. If multiple bits are * selected in other situations, then both drives are selected, and any * read signals get yucky. */ if (data & 0x04) drive = 2; else if (data & 0x02) drive = 1; else if (data & 0x01) drive = 0; else if (data & 0x40) drive = 3; device_t *floppy[4]; floppy[0] = subdevice(FLOPPY_0); floppy[1] = subdevice(FLOPPY_1); floppy[2] = subdevice(FLOPPY_2); floppy[3] = subdevice(FLOPPY_3); for (int i = 0; i < 4; i++) { floppy_mon_w(floppy[i], i == drive ? CLEAR_LINE : ASSERT_LINE); } head = ((data & 0x40) && (drive != 3)) ? 1 : 0; m_dskreg = data; update_lines(); wd17xx_set_drive(m_wd17xx, drive); wd17xx_set_side(m_wd17xx, head); wd17xx_dden_w(m_wd17xx, !BIT(m_dskreg, 5)); }
void rx01_device::device_reset() { for(int i=0;i<2;i++) { floppy_mon_w(m_image[i], 0); // turn it on floppy_drive_set_controller(m_image[i], this); floppy_drive_set_rpm(m_image[i], 360.); } }
void ms0515_state::machine_reset() { UINT8 *ram = m_ram->pointer(); ms0515_bank_w(machine().driver_data()->generic_space(),0,0); m_video_ram = ram + 0000000 + 0340000; m_blink = 0; floppy_mon_w(machine().device(FLOPPY_0), 0); // turn it on }
inline void c2040_device::spindle_motor(int unit, int mtr) { if (m_unit[unit].m_mtr != mtr) { if (!mtr) { // read track data read_current_track(unit); } floppy_mon_w(m_unit[unit].m_image, mtr); m_unit[unit].m_mtr = mtr; } }
static void spindle_motor(c1551_t *c1551, int mtr) { if (c1551->mtr != mtr) { if (mtr) { /* read track data */ read_current_track(c1551); } floppy_mon_w(c1551->image, !mtr); c1551->bit_timer->enable(mtr); c1551->mtr = mtr; } }
void trs80m2_state::machine_start() { // Shugart SA-800 motor spins constantly floppy_mon_w(m_floppy, CLEAR_LINE); // register for state saving save_item(NAME(m_boot_rom)); save_item(NAME(m_bank)); save_item(NAME(m_msel)); save_item(NAME(m_key_latch)); save_item(NAME(m_key_data)); save_item(NAME(m_key_bit)); save_item(NAME(m_kbclk)); save_item(NAME(m_kbdata)); save_item(NAME(m_kbirq)); save_item(NAME(m_blnkvid)); save_item(NAME(m_80_40_char_en)); save_item(NAME(m_de)); save_item(NAME(m_rtc_int)); save_item(NAME(m_enable_rtc_int)); }
static void i8271_command_execute(device_t *device) { i8271_t *i8271 = get_safe_token(device); device_t *img = current_image(device); /* clear it = good completion status */ /* this will be changed if anything bad happens! */ i8271->ResultRegister = 0; switch (i8271->Command) { case I8271_COMMAND_SPECIFY: { switch (i8271->CommandParameters[0]) { case 0x0d: { LOG(("Initialization\n")); i8271->StepRate = i8271->CommandParameters[1]; i8271->HeadSettlingTime = i8271->CommandParameters[2]; i8271->IndexCountBeforeHeadUnload = (i8271->CommandParameters[3]>>4) & 0x0f; i8271->HeadLoadTime = (i8271->CommandParameters[3] & 0x0f); } break; case 0x010: { LOG(("Load bad Tracks Surface 0\n")); i8271_load_bad_tracks(device,0); } break; case 0x018: { LOG(("Load bad Tracks Surface 1\n")); i8271_load_bad_tracks(device,1); } break; } /* no result */ i8271_command_complete(device,0,0); } break; case I8271_COMMAND_READ_SPECIAL_REGISTER: { /* unknown - what is read when a special register that isn't allowed is specified? */ int data = 0x0ff; switch (i8271->CommandParameters[0]) { case I8271_SPECIAL_REGISTER_MODE_REGISTER: { data = i8271->Mode; } break; case I8271_SPECIAL_REGISTER_SURFACE_0_CURRENT_TRACK: { data = i8271_read_current_track(device, 0); } break; case I8271_SPECIAL_REGISTER_SURFACE_1_CURRENT_TRACK: { data = i8271_read_current_track(device, 1); } break; case I8271_SPECIAL_REGISTER_SURFACE_0_BAD_TRACK_1: { data = i8271_read_bad_track(device, 0,1); } break; case I8271_SPECIAL_REGISTER_SURFACE_0_BAD_TRACK_2: { data = i8271_read_bad_track(device, 0,2); } break; case I8271_SPECIAL_REGISTER_SURFACE_1_BAD_TRACK_1: { data = i8271_read_bad_track(device, 1,1); } break; case I8271_SPECIAL_REGISTER_SURFACE_1_BAD_TRACK_2: { data = i8271_read_bad_track(device, 1,2); } break; case I8271_SPECIAL_REGISTER_DRIVE_CONTROL_OUTPUT_PORT: { FDC_LOG_COMMAND("Read Drive Control Output port\n"); i8271_get_drive(device); /* assumption: select bits reflect the select bits from the previous command. i.e. read drive status */ data = (i8271->drive_control_output & ~0x0c0) | (i8271->CommandRegister & 0x0c0); } break; case I8271_SPECIAL_REGISTER_DRIVE_CONTROL_INPUT_PORT: { /* bit 7: not used */ /* bit 6: ready 1 */ /* bit 5: write fault */ /* bit 4: index */ /* bit 3: wr prot */ /* bit 2: rdy 0 */ /* bit 1: track 0 */ /* bit 0: cnt/opi */ FDC_LOG_COMMAND("Read Drive Control Input port\n"); i8271->drive_control_input = (1<<6) | (1<<2); /* bit 3 = 0 if write protected */ i8271->drive_control_input |= floppy_wpt_r(img) << 3; /* bit 1 = 0 if head at track 0 */ i8271->drive_control_input |= floppy_tk00_r(img) << 1; /* need to setup this register based on drive selected */ data = i8271->drive_control_input; } break; } i8271->ResultRegister = data; i8271_command_complete(device,1,0); } break; case I8271_COMMAND_WRITE_SPECIAL_REGISTER: { switch (i8271->CommandParameters[0]) { case I8271_SPECIAL_REGISTER_MODE_REGISTER: { /* TODO: Check bits 6-7 and 5-2 are valid */ i8271->Mode = i8271->CommandParameters[1]; if (i8271->Mode & 0x01) { LOG(("Mode: Non-DMA\n")); } else { LOG(("Mode: DMA\n")); } if (i8271->Mode & 0x02) { LOG(("Single actuator\n")); } else { LOG(("Double actuator\n")); } } break; case I8271_SPECIAL_REGISTER_SURFACE_0_CURRENT_TRACK: { LOG(("Surface 0 Current Track\n")); i8271_write_current_track(device, 0, i8271->CommandParameters[1]); } break; case I8271_SPECIAL_REGISTER_SURFACE_1_CURRENT_TRACK: { LOG(("Surface 1 Current Track\n")); i8271_write_current_track(device, 1, i8271->CommandParameters[1]); } break; case I8271_SPECIAL_REGISTER_SURFACE_0_BAD_TRACK_1: { LOG(("Surface 0 Bad Track 1\n")); i8271_write_bad_track(device, 0, 1, i8271->CommandParameters[1]); } break; case I8271_SPECIAL_REGISTER_SURFACE_0_BAD_TRACK_2: { LOG(("Surface 0 Bad Track 2\n")); i8271_write_bad_track(device, 0, 2,i8271->CommandParameters[1]); } break; case I8271_SPECIAL_REGISTER_SURFACE_1_BAD_TRACK_1: { LOG(("Surface 1 Bad Track 1\n")); i8271_write_bad_track(device, 1, 1, i8271->CommandParameters[1]); } break; case I8271_SPECIAL_REGISTER_SURFACE_1_BAD_TRACK_2: { LOG(("Surface 1 Bad Track 2\n")); i8271_write_bad_track(device, 1, 2, i8271->CommandParameters[1]); } break; case I8271_SPECIAL_REGISTER_DRIVE_CONTROL_OUTPUT_PORT: { // /* get drive selected */ // i8271->drive = (i8271->CommandParameters[1]>>6) & 0x03; FDC_LOG_COMMAND("Write Drive Control Output port\n"); if (i8271->CommandParameters[1] & 0x01) { LOG(("Write Enable\n")); } if (i8271->CommandParameters[1] & 0x02) { LOG(("Seek/Step\n")); } if (i8271->CommandParameters[1] & 0x04) { LOG(("Direction\n")); } if (i8271->CommandParameters[1] & 0x08) { LOG(("Load Head\n")); } if (i8271->CommandParameters[1] & 0x010) { LOG(("Low head current\n")); } if (i8271->CommandParameters[1] & 0x020) { LOG(("Write Fault Reset\n")); } LOG(("Select %02x\n", (i8271->CommandParameters[1] & 0x0c0)>>6)); /* get drive */ i8271_get_drive(device); /* on bbc dfs 09 this is the side select output */ i8271->side = (i8271->CommandParameters[1]>>5) & 0x01; /* load head - on mini-sized drives this turns on the disc motor, on standard-sized drives this loads the head and turns the motor on */ floppy_mon_w(img, !BIT(i8271->CommandParameters[1], 3)); floppy_drive_set_ready_state(img, 1, 1); /* step pin changed? if so perform a step in the direction indicated */ if (((i8271->drive_control_output^i8271->CommandParameters[1]) & (1<<1))!=0) { /* step pin changed state? */ if ((i8271->CommandParameters[1] & (1<<1))!=0) { signed int signed_tracks; if ((i8271->CommandParameters[1] & (1<<2))!=0) { signed_tracks = 1; } else { signed_tracks = -1; } floppy_drive_seek(img, signed_tracks); } } i8271->drive_control_output = i8271->CommandParameters[1]; } break; case I8271_SPECIAL_REGISTER_DRIVE_CONTROL_INPUT_PORT: { FDC_LOG_COMMAND("Write Drive Control Input port\n"); // i8271->drive_control_input = i8271->CommandParameters[1]; } break; } /* write doesn't supply a result */ i8271_command_complete(device,0,0); } break; case I8271_COMMAND_READ_DRIVE_STATUS: { unsigned char status; i8271_get_drive(device); /* no write fault */ status = 0; status |= (1<<2) | (1<<6); /* these two do not appear to be set at all! ?? */ if (i8271->intf->floppy_drive_tags[0]!=NULL) { if (floppy_drive_get_flag_state(device->machine().device(i8271->intf->floppy_drive_tags[0]), FLOPPY_DRIVE_READY)) { status |= (1<<2); } } if (i8271->intf->floppy_drive_tags[1]!=NULL) { if (floppy_drive_get_flag_state(device->machine().device(i8271->intf->floppy_drive_tags[1]), FLOPPY_DRIVE_READY)) { status |= (1<<6); } } /* bit 3 = 1 if write protected */ status |= !floppy_wpt_r(img) << 3; /* bit 1 = 1 if head at track 0 */ status |= !floppy_tk00_r(img) << 1; i8271->ResultRegister = status; i8271_command_complete(device,1,0); } break; case I8271_COMMAND_SEEK: { i8271_get_drive(device); i8271_seek_to_track(device,i8271->CommandParameters[0]); /* check for bad seek */ i8271_timed_command_complete(device); } break; case I8271_COMMAND_READ_DATA_MULTI_RECORD: { /* N value as stored in ID field */ i8271->ID_N = (i8271->CommandParameters[2]>>5) & 0x07; /* starting sector id */ i8271->ID_R = i8271->CommandParameters[1]; /* number of sectors to transfer */ i8271->Counter = i8271->CommandParameters[2] & 0x01f; FDC_LOG_COMMAND("READ DATA MULTI RECORD"); LOG(("Sector Count: %02x\n", i8271->Counter)); LOG(("Track: %02x\n",i8271->CommandParameters[0])); LOG(("Sector: %02x\n", i8271->CommandParameters[1])); LOG(("Sector Length: %02x bytes\n", 1<<(i8271->ID_N+7))); i8271_get_drive(device); if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY)) { /* Completion type: operation intervention probably required for recovery */ /* Completion code: Drive not ready */ i8271->ResultRegister = (2<<3); i8271_timed_command_complete(device); } else { i8271_seek_to_track(device,i8271->CommandParameters[0]); i8271_do_read(device); } } break; case I8271_COMMAND_READ_DATA_SINGLE_RECORD: { FDC_LOG_COMMAND("READ DATA SINGLE RECORD"); i8271->ID_N = 0; i8271->Counter = 1; i8271->ID_R = i8271->CommandParameters[1]; LOG(("Sector Count: %02x\n", i8271->Counter)); LOG(("Track: %02x\n",i8271->CommandParameters[0])); LOG(("Sector: %02x\n", i8271->CommandParameters[1])); LOG(("Sector Length: %02x bytes\n", 1<<(i8271->ID_N+7))); i8271_get_drive(device); if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY)) { /* Completion type: operation intervention probably required for recovery */ /* Completion code: Drive not ready */ i8271->ResultRegister = (2<<3); i8271_timed_command_complete(device); } else { i8271_seek_to_track(device,i8271->CommandParameters[0]); i8271_do_read(device); } } break; case I8271_COMMAND_WRITE_DATA_MULTI_RECORD: { /* N value as stored in ID field */ i8271->ID_N = (i8271->CommandParameters[2]>>5) & 0x07; /* starting sector id */ i8271->ID_R = i8271->CommandParameters[1]; /* number of sectors to transfer */ i8271->Counter = i8271->CommandParameters[2] & 0x01f; FDC_LOG_COMMAND("READ DATA MULTI RECORD"); LOG(("Sector Count: %02x\n", i8271->Counter)); LOG(("Track: %02x\n",i8271->CommandParameters[0])); LOG(("Sector: %02x\n", i8271->CommandParameters[1])); LOG(("Sector Length: %02x bytes\n", 1<<(i8271->ID_N+7))); i8271_get_drive(device); i8271->drive_control_output &=~1; if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY)) { /* Completion type: operation intervention probably required for recovery */ /* Completion code: Drive not ready */ i8271->ResultRegister = (2<<3); i8271_timed_command_complete(device); } else { if (floppy_wpt_r(img) == CLEAR_LINE) { /* Completion type: operation intervention probably required for recovery */ /* Completion code: Drive write protected */ i8271->ResultRegister = (2<<3) | (1<<1); i8271_timed_command_complete(device); } else { i8271->drive_control_output |=1; i8271_seek_to_track(device,i8271->CommandParameters[0]); i8271_do_write(device); } } } break; case I8271_COMMAND_WRITE_DATA_SINGLE_RECORD: { FDC_LOG_COMMAND("WRITE DATA SINGLE RECORD"); i8271->ID_N = 0; i8271->Counter = 1; i8271->ID_R = i8271->CommandParameters[1]; LOG(("Sector Count: %02x\n", i8271->Counter)); LOG(("Track: %02x\n",i8271->CommandParameters[0])); LOG(("Sector: %02x\n", i8271->CommandParameters[1])); LOG(("Sector Length: %02x bytes\n", 1<<(i8271->ID_N+7))); i8271_get_drive(device); i8271->drive_control_output &=~1; if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY)) { /* Completion type: operation intervention probably required for recovery */ /* Completion code: Drive not ready */ i8271->ResultRegister = (2<<3); i8271_timed_command_complete(device); } else { if (floppy_wpt_r(img) == CLEAR_LINE) { /* Completion type: operation intervention probably required for recovery */ /* Completion code: Drive write protected */ i8271->ResultRegister = (2<<3) | (1<<1); i8271_timed_command_complete(device); } else { i8271->drive_control_output |=1; i8271_seek_to_track(device,i8271->CommandParameters[0]); i8271_do_write(device); } } } break; case I8271_COMMAND_READ_ID: { FDC_LOG_COMMAND("READ ID"); LOG(("Track: %02x\n",i8271->CommandParameters[0])); LOG(("ID Field Count: %02x\n", i8271->CommandParameters[2])); i8271_get_drive(device); if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY)) { /* Completion type: operation intervention probably required for recovery */ /* Completion code: Drive not ready */ i8271->ResultRegister = (2<<3); i8271_timed_command_complete(device); } else { i8271->Counter = i8271->CommandParameters[2]; i8271_seek_to_track(device,i8271->CommandParameters[0]); i8271_do_read_id(device); } } break; default: LOG(("ERROR Unrecognised Command\n")); break; } }