trunk/src/mess/drivers/pc.c
| r19964 | r19965 | |
| 97 | 97 | #include "machine/am9517a.h" |
| 98 | 98 | #include "sound/sn76496.h" |
| 99 | 99 | |
| 100 | | #include "machine/wd17xx.h" |
| 100 | #include "machine/wd_fdc.h" |
| 101 | 101 | #include "machine/kb_7007_3.h" |
| 102 | 102 | |
| 103 | 103 | #include "machine/ram.h" |
| r19964 | r19965 | |
| 161 | 161 | AM_RANGE(0x0100, 0x0100) AM_READWRITE(mc1502_wd17xx_aux_r, mc1502_wd17xx_aux_w) |
| 162 | 162 | AM_RANGE(0x0108, 0x0108) AM_READ(mc1502_wd17xx_drq_r) // blocking read! |
| 163 | 163 | AM_RANGE(0x010a, 0x010a) AM_READ(mc1502_wd17xx_motor_r) |
| 164 | | AM_RANGE(0x010c, 0x010c) AM_DEVREADWRITE_LEGACY("vg93", wd17xx_status_r, wd17xx_command_w) |
| 165 | | AM_RANGE(0x010d, 0x010d) AM_DEVREADWRITE_LEGACY("vg93", wd17xx_track_r, wd17xx_track_w) |
| 166 | | AM_RANGE(0x010e, 0x010e) AM_DEVREADWRITE_LEGACY("vg93", wd17xx_sector_r, wd17xx_sector_w) |
| 167 | | AM_RANGE(0x010f, 0x010f) AM_DEVREADWRITE_LEGACY("vg93", wd17xx_data_r, wd17xx_data_w) |
| 164 | AM_RANGE(0x010c, 0x010f) AM_DEVREADWRITE("vg93", fd1793_t, read, write) |
| 168 | 165 | ADDRESS_MAP_END |
| 169 | 166 | |
| 170 | 167 | static ADDRESS_MAP_START( zenith_map, AS_PROGRAM, 8, pc_state ) |
| r19964 | r19965 | |
| 867 | 864 | DEVCB_CPU_INPUT_LINE("maincpu", 0) |
| 868 | 865 | }; |
| 869 | 866 | |
| 870 | | static const floppy_interface mc1502_floppy_interface = |
| 871 | | { |
| 872 | | DEVCB_NULL, |
| 873 | | DEVCB_NULL, |
| 874 | | DEVCB_NULL, |
| 875 | | DEVCB_NULL, |
| 876 | | DEVCB_NULL, |
| 877 | | FLOPPY_STANDARD_5_25_DSHD, |
| 878 | | LEGACY_FLOPPY_OPTIONS_NAME(pc), |
| 879 | | "floppy_5_25", |
| 880 | | NULL |
| 881 | | }; |
| 882 | | |
| 883 | 867 | FLOPPY_FORMATS_MEMBER( pc_state::floppy_formats ) |
| 884 | 868 | FLOPPY_PC_FORMAT |
| 885 | 869 | FLOPPY_FORMATS_END |
| r19964 | r19965 | |
| 1398 | 1382 | /* cassette */ |
| 1399 | 1383 | MCFG_CASSETTE_ADD( CASSETTE_TAG, mc1502_cassette_interface ) // has no motor control |
| 1400 | 1384 | |
| 1401 | | MCFG_FD1793_ADD( "vg93", default_wd17xx_interface_2_drives ) |
| 1402 | | MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(mc1502_floppy_interface) |
| 1385 | MCFG_FD1793x_ADD("vg93", XTAL_8MHz / 8) // clock? |
| 1386 | MCFG_FLOPPY_DRIVE_ADD("fd0", ibmpc_floppies, "525dd", 0, pc_state::floppy_formats) |
| 1387 | MCFG_FLOPPY_DRIVE_ADD("fd1", ibmpc_floppies, "525dd", 0, pc_state::floppy_formats) |
| 1403 | 1388 | |
| 1404 | 1389 | /* internal ram */ |
| 1405 | 1390 | MCFG_RAM_ADD(RAM_TAG) |
trunk/src/mess/machine/pc.c
| r19964 | r19965 | |
| 37 | 37 | #include "sound/speaker.h" |
| 38 | 38 | |
| 39 | 39 | #include "machine/am9517a.h" |
| 40 | | #include "machine/wd17xx.h" |
| 40 | #include "machine/wd_fdc.h" |
| 41 | 41 | |
| 42 | 42 | #include "machine/ram.h" |
| 43 | 43 | |
| r19964 | r19965 | |
| 1280 | 1280 | |
| 1281 | 1281 | WRITE8_MEMBER(pc_state::mc1502_wd17xx_aux_w) |
| 1282 | 1282 | { |
| 1283 | fd1793_t *fdc = machine().device<fd1793_t>("vg93"); |
| 1284 | floppy_image_device *floppy0 = machine().device<floppy_connector>("fd0")->get_device(); |
| 1285 | floppy_image_device *floppy1 = machine().device<floppy_connector>("fd1")->get_device(); |
| 1286 | floppy_image_device *floppy = ((data & 0x10)?floppy1:floppy0); |
| 1287 | fdc->set_floppy(floppy); |
| 1288 | |
| 1283 | 1289 | // master reset |
| 1284 | | wd17xx_mr_w(machine().device("vg93"), BIT(data, 0)); |
| 1290 | if(data & 1) |
| 1291 | fdc->reset(); |
| 1285 | 1292 | |
| 1286 | 1293 | // SIDE ONE |
| 1287 | | wd17xx_set_side(machine().device("vg93"), BIT(data, 1)); |
| 1294 | floppy->ss_w((data & 2)?1:0); |
| 1288 | 1295 | |
| 1289 | 1296 | // bits 2, 3 -- motor on (drive 0, 1) |
| 1290 | | |
| 1291 | | // DRIVE SEL |
| 1292 | | wd17xx_set_drive(machine().device("vg93"), BIT(data, 4)); |
| 1297 | floppy0->mon_w(!(data & 4)); |
| 1298 | floppy1->mon_w(!(data & 8)); |
| 1293 | 1299 | } |
| 1294 | 1300 | |
| 1295 | 1301 | /* |
| r19964 | r19965 | |
| 1297 | 1303 | */ |
| 1298 | 1304 | READ8_MEMBER(pc_state::mc1502_wd17xx_drq_r) |
| 1299 | 1305 | { |
| 1300 | | UINT8 data; |
| 1301 | | UINT64 newpc; |
| 1306 | fd1793_t *fdc = machine().device<fd1793_t>("vg93"); |
| 1302 | 1307 | |
| 1303 | | data = wd17xx_drq_r(machine().device("vg93")); |
| 1304 | | if (!data && !wd17xx_intrq_r(machine().device("vg93"))) { |
| 1305 | | /* fake cpu halt by resetting PC one insn back */ |
| 1306 | | newpc = machine().firstcpu->pc(); |
| 1307 | | machine().firstcpu->set_pc( newpc - 1 ); |
| 1308 | if (!fdc->drq_r() && !fdc->intrq_r()) { |
| 1309 | /* fake cpu wait by resetting PC one insn back */ |
| 1310 | m_maincpu->set_pc(m_maincpu->pc() - 1); |
| 1311 | m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); |
| 1308 | 1312 | } |
| 1309 | 1313 | |
| 1310 | | return data; |
| 1314 | return fdc->drq_r(); |
| 1311 | 1315 | } |
| 1312 | 1316 | |
| 1317 | void pc_state::mc1502_fdc_irq_drq(bool state) |
| 1318 | { |
| 1319 | if(state) |
| 1320 | m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); |
| 1321 | } |
| 1322 | |
| 1313 | 1323 | READ8_MEMBER(pc_state::mc1502_wd17xx_motor_r) |
| 1314 | 1324 | { |
| 1315 | 1325 | UINT8 data; |
| r19964 | r19965 | |
| 1516 | 1526 | memset(&mc1502_keyb, 0, sizeof(mc1502_keyb)); |
| 1517 | 1527 | mc1502_keyb.keyb_signal_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc_state::mc1502_keyb_signal_callback),this)); |
| 1518 | 1528 | mc1502_keyb.keyb_signal_timer->adjust( attotime::from_msec(20), 0, attotime::from_msec(20) ); |
| 1529 | |
| 1530 | fd1793_t *fdc = machine().device<fd1793_t>("vg93"); |
| 1531 | fdc->setup_drq_cb(fd1793_t::line_cb(FUNC(pc_state::mc1502_fdc_irq_drq), this)); |
| 1532 | fdc->setup_intrq_cb(fd1793_t::line_cb(FUNC(pc_state::mc1502_fdc_irq_drq), this)); |
| 1519 | 1533 | } |
| 1520 | 1534 | |
| 1521 | 1535 | |