trunk/src/mess/drivers/excali64.c
| r242594 | r242595 | |
| 19 | 19 | |
| 20 | 20 | ToDo: |
| 21 | 21 | - Colours are approximate. |
| 22 | | - Disk controller, using the old wd17xx because new wd crashes on loading a disk. |
| 22 | - Disk controller, works with old wd17xx but crashes on new wd. |
| 23 | 23 | - Hardware supports 20cm and 13cm floppies, but we only support 13cm as this |
| 24 | 24 | is the only software that exists. |
| 25 | 25 | - The schematic shows the audio counter connected to 2MHz, but this produces |
| r242594 | r242595 | |
| 29 | 29 | |
| 30 | 30 | ****************************************************************************/ |
| 31 | 31 | |
| 32 | #define NEWFDC 0 |
| 33 | |
| 34 | |
| 32 | 35 | #include "emu.h" |
| 33 | 36 | #include "cpu/z80/z80.h" |
| 34 | 37 | #include "video/mc6845.h" |
| 35 | 38 | #include "machine/i8251.h" |
| 36 | 39 | #include "bus/rs232/rs232.h" |
| 40 | //#include "machine/clock.h" |
| 37 | 41 | #include "machine/pit8253.h" |
| 38 | 42 | #include "machine/i8255.h" |
| 39 | 43 | #include "bus/centronics/ctronics.h" |
| r242594 | r242595 | |
| 43 | 47 | #include "machine/z80dma.h" |
| 44 | 48 | #include "machine/rescap.h" |
| 45 | 49 | #include "machine/74123.h" |
| 50 | #if NEWFDC |
| 51 | #include "machine/wd_fdc.h" |
| 52 | #include "formats/excali64_dsk.h" |
| 53 | #else |
| 46 | 54 | #include "machine/wd17xx.h" |
| 47 | 55 | #include "imagedev/flopdrv.h" |
| 48 | 56 | #include "formats/basicdsk.h" |
| 57 | #endif |
| 49 | 58 | |
| 50 | 59 | class excali64_state : public driver_device |
| 51 | 60 | { |
| r242594 | r242595 | |
| 61 | 70 | , m_u12(*this, "u12") |
| 62 | 71 | , m_centronics(*this, "centronics") |
| 63 | 72 | , m_fdc(*this, "fdc") |
| 73 | #if NEWFDC |
| 74 | , m_floppy0(*this, "fdc:0") |
| 75 | , m_floppy1(*this, "fdc:1") |
| 76 | #endif |
| 64 | 77 | { } |
| 65 | 78 | |
| 66 | 79 | DECLARE_PALETTE_INIT(excali64); |
| r242594 | r242595 | |
| 73 | 86 | DECLARE_WRITE8_MEMBER(porte4_w); |
| 74 | 87 | DECLARE_READ8_MEMBER(porte8_r); |
| 75 | 88 | DECLARE_WRITE8_MEMBER(portec_w); |
| 89 | #if NEWFDC |
| 90 | DECLARE_FLOPPY_FORMATS(floppy_formats); |
| 91 | #endif |
| 76 | 92 | DECLARE_WRITE_LINE_MEMBER(cent_busy_w); |
| 77 | 93 | DECLARE_WRITE_LINE_MEMBER(busreq_w); |
| 78 | 94 | DECLARE_READ8_MEMBER(memory_read_byte); |
| r242594 | r242595 | |
| 103 | 119 | required_device<z80dma_device> m_dma; |
| 104 | 120 | required_device<ttl74123_device> m_u12; |
| 105 | 121 | required_device<centronics_device> m_centronics; |
| 122 | #if NEWFDC |
| 123 | required_device<wd2793_t> m_fdc; |
| 124 | required_device<floppy_connector> m_floppy0; |
| 125 | required_device<floppy_connector> m_floppy1; |
| 126 | #else |
| 106 | 127 | required_device<wd2793_device> m_fdc; |
| 128 | #endif |
| 107 | 129 | }; |
| 108 | 130 | |
| 109 | 131 | static ADDRESS_MAP_START(excali64_mem, AS_PROGRAM, 8, excali64_state) |
| r242594 | r242595 | |
| 129 | 151 | AM_RANGE(0xe4, 0xe7) AM_WRITE(porte4_w) |
| 130 | 152 | AM_RANGE(0xe8, 0xeb) AM_READ(porte8_r) |
| 131 | 153 | AM_RANGE(0xec, 0xef) AM_WRITE(portec_w) |
| 154 | #if NEWFDC |
| 155 | AM_RANGE(0xf0, 0xf3) AM_DEVREADWRITE("fdc", wd2793_t, read, write) |
| 156 | #else |
| 132 | 157 | AM_RANGE(0xf0, 0xf3) AM_DEVREADWRITE("fdc", wd2793_device, read, write) |
| 158 | #endif |
| 133 | 159 | ADDRESS_MAP_END |
| 134 | 160 | |
| 135 | 161 | |
| r242594 | r242595 | |
| 220 | 246 | m_centronics_busy = state; |
| 221 | 247 | } |
| 222 | 248 | |
| 249 | #if NEWFDC |
| 250 | FLOPPY_FORMATS_MEMBER( excali64_state::floppy_formats ) |
| 251 | FLOPPY_EXCALI64_FORMAT |
| 252 | FLOPPY_FORMATS_END |
| 253 | |
| 254 | static SLOT_INTERFACE_START( excali64_floppies ) |
| 255 | SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) |
| 256 | SLOT_INTERFACE_END |
| 257 | #else |
| 223 | 258 | static LEGACY_FLOPPY_OPTIONS_START(excali64) |
| 224 | 259 | LEGACY_FLOPPY_OPTION(excali64_ds, "raw", "Excalibur 64 DS disk image", basicdsk_identify_default, basicdsk_construct_default, NULL, |
| 225 | 260 | HEADS([2]) |
| r242594 | r242595 | |
| 235 | 270 | LEGACY_FLOPPY_OPTIONS_NAME(excali64), |
| 236 | 271 | NULL |
| 237 | 272 | }; |
| 273 | #endif |
| 238 | 274 | |
| 239 | 275 | // pulses from port E4 bit 5 restart the 74123. After 3.6 secs without a pulse, the motor gets turned off. |
| 240 | 276 | WRITE8_MEMBER( excali64_state::motor_w ) |
| 241 | 277 | { |
| 242 | 278 | m_motor = BIT(data, 0); |
| 279 | #if NEWFDC |
| 280 | m_floppy1->get_device()->mon_w(!m_motor); |
| 281 | m_floppy0->get_device()->mon_w(!m_motor); |
| 282 | #else |
| 243 | 283 | legacy_floppy_image_device *flop = subdevice<legacy_floppy_image_device>(FLOPPY_0); |
| 244 | 284 | flop->floppy_mon_w(!m_motor); // motor on |
| 245 | 285 | flop = subdevice<legacy_floppy_image_device>(FLOPPY_1); |
| 246 | 286 | flop->floppy_mon_w(!m_motor); // motor on |
| 287 | #endif |
| 247 | 288 | } |
| 248 | 289 | |
| 249 | 290 | READ8_MEMBER( excali64_state::porte8_r ) |
| r242594 | r242595 | |
| 253 | 294 | |
| 254 | 295 | WRITE8_MEMBER( excali64_state::porte4_w ) |
| 255 | 296 | { |
| 297 | #if NEWFDC |
| 298 | floppy_image_device *floppy = NULL; |
| 299 | if (BIT(data, 0)) |
| 300 | floppy = m_floppy0->get_device(); |
| 301 | |
| 302 | if (BIT(data, 1)) |
| 303 | floppy = m_floppy1->get_device(); |
| 304 | |
| 305 | if (floppy) |
| 306 | { |
| 307 | m_fdc->set_floppy(floppy); |
| 308 | floppy->ss_w(BIT(data, 4)); |
| 309 | } |
| 310 | #else |
| 256 | 311 | if BIT(data, 0) |
| 257 | 312 | m_fdc->set_drive(0); |
| 258 | 313 | |
| r242594 | r242595 | |
| 260 | 315 | m_fdc->set_drive(1); |
| 261 | 316 | |
| 262 | 317 | m_fdc->set_side(BIT(data, 4)); |
| 318 | #endif |
| 263 | 319 | |
| 264 | 320 | m_u12->b_w(space,offset, BIT(data, 5)); // motor pulse |
| 265 | 321 | } |
| r242594 | r242595 | |
| 271 | 327 | */ |
| 272 | 328 | WRITE8_MEMBER( excali64_state::portec_w ) |
| 273 | 329 | { |
| 330 | #if NEWFDC |
| 331 | m_fdc->dden_w(BIT(data, 2)); |
| 332 | #else |
| 274 | 333 | m_fdc->dden_w(!BIT(data, 2)); |
| 334 | #endif |
| 275 | 335 | } |
| 276 | 336 | |
| 277 | 337 | WRITE_LINE_MEMBER( excali64_state::busreq_w ) |
| r242594 | r242595 | |
| 592 | 652 | |
| 593 | 653 | /* Devices */ |
| 594 | 654 | MCFG_CASSETTE_ADD( "cassette" ) |
| 655 | #if NEWFDC |
| 656 | MCFG_WD2793x_ADD("fdc", XTAL_16MHz / 16) |
| 657 | MCFG_WD_FDC_FORCE_READY |
| 658 | MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w)) |
| 659 | MCFG_FLOPPY_DRIVE_ADD("fdc:0", excali64_floppies, "525dd", floppy_image_device::default_floppy_formats)// excali64_state::floppy_formats) |
| 660 | MCFG_FLOPPY_DRIVE_ADD("fdc:1", excali64_floppies, "525dd", floppy_image_device::default_floppy_formats) |
| 661 | #else |
| 595 | 662 | MCFG_DEVICE_ADD("fdc", WD2793, 0) |
| 596 | 663 | MCFG_WD17XX_DEFAULT_DRIVE2_TAGS |
| 597 | 664 | MCFG_WD17XX_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w)) |
| 598 | 665 | MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(excali64_floppy_interface) |
| 599 | | |
| 666 | #endif |
| 600 | 667 | MCFG_DEVICE_ADD("dma", Z80DMA, XTAL_16MHz/4) |
| 601 | 668 | MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(excali64_state, busreq_w)) |
| 602 | 669 | MCFG_Z80DMA_IN_MREQ_CB(READ8(excali64_state, memory_read_byte)) |