trunk/src/emu/bus/ti99_peb/peribox.c
| r30888 | r30889 | |
| 339 | 339 | */ |
| 340 | 340 | void peribox_device::inta_join(int slot, int state) |
| 341 | 341 | { |
| 342 | | if (TRACE_INT) logerror("Peribox propagating INTA from slot %d to console: %d\n", slot, state); |
| 342 | if (TRACE_INT) logerror("%s: propagating INTA from slot %d to console: %d\n", tag(), slot, state); |
| 343 | 343 | if (state==ASSERT_LINE) |
| 344 | 344 | m_inta_flag |= (1 << slot); |
| 345 | 345 | else |
| r30888 | r30889 | |
| 350 | 350 | |
| 351 | 351 | void peribox_device::intb_join(int slot, int state) |
| 352 | 352 | { |
| 353 | | if (TRACE_INT) logerror("Peribox propagating INTB from slot %d to console: %d\n", slot, state); |
| 353 | if (TRACE_INT) logerror("%s: propagating INTB from slot %d to console: %d\n", tag(), slot, state); |
| 354 | 354 | if (state==ASSERT_LINE) |
| 355 | 355 | m_intb_flag |= (1 << slot); |
| 356 | 356 | else |
| r30888 | r30889 | |
| 364 | 364 | */ |
| 365 | 365 | void peribox_device::ready_join(int slot, int state) |
| 366 | 366 | { |
| 367 | | if (TRACE_READY) logerror("peribox: Incoming READY=%d from slot %d\n", state, slot); |
| 367 | if (TRACE_READY) logerror("%s: Incoming READY=%d from slot %d\n", tag(), state, slot); |
| 368 | 368 | // We store the inverse state |
| 369 | 369 | if (state==CLEAR_LINE) |
| 370 | 370 | m_ready_flag |= (1 << slot); |
| r30888 | r30889 | |
| 376 | 376 | |
| 377 | 377 | void peribox_device::set_slot_loaded(int slot, peribox_slot_device* slotdev) |
| 378 | 378 | { |
| 379 | | if (TRACE_EMU) |
| 380 | | { |
| 381 | | if (slotdev!=NULL) logerror("Setting slot %d to device %s\n", slot, slotdev->tag()); |
| 382 | | else logerror("Setting slot %d to EMPTY\n", slot); |
| 383 | | } |
| 384 | 379 | m_slot[slot] = slotdev; |
| 385 | 380 | } |
| 386 | 381 | |
| 387 | 382 | void peribox_device::device_start(void) |
| 388 | 383 | { |
| 389 | | if (TRACE_EMU) logerror("Peribox started\n"); |
| 384 | if (TRACE_EMU) logerror("%s: started\n", tag()); |
| 390 | 385 | |
| 391 | 386 | subdevice<legacy_floppy_image_device>(FLOPPY_0)->floppy_drive_set_rpm(300.); |
| 392 | 387 | subdevice<legacy_floppy_image_device>(FLOPPY_1)->floppy_drive_set_rpm(300.); |
| r30888 | r30889 | |
| 398 | 393 | m_console_intb.resolve(); |
| 399 | 394 | m_datamux_ready.resolve(); |
| 400 | 395 | |
| 401 | | if (TRACE_EMU) logerror("AMA/B/C address prefix set to %05x\n", m_address_prefix); |
| 396 | if (TRACE_EMU) |
| 397 | { |
| 398 | logerror("%s: AMA/B/C address prefix set to %05x\n", tag(), m_address_prefix); |
| 399 | for (int i=2; i < 9; i++) |
| 400 | { |
| 401 | logerror("%s: Slot %d = %s\n", tag(), i, (m_slot[i] != NULL)? m_slot[i]->m_card->tag() : "EMPTY"); |
| 402 | } |
| 403 | } |
| 402 | 404 | } |
| 403 | 405 | |
| 404 | 406 | void peribox_device::device_config_complete() |
| r30888 | r30889 | |
| 431 | 433 | SLOT_INTERFACE("usbsm", TI99_USBSM) |
| 432 | 434 | SLOT_INTERFACE("bwgleg", TI99_BWG_LEG) |
| 433 | 435 | SLOT_INTERFACE("bwg", TI99_BWG) |
| 434 | | SLOT_INTERFACE("hfdc", TI99_HFDC) |
| 436 | SLOT_INTERFACE("hfdc", TI99_HFDC_LEG) |
| 437 | SLOT_INTERFACE("hfdcnew", TI99_HFDC) |
| 435 | 438 | SLOT_INTERFACE_END |
| 436 | 439 | |
| 437 | 440 | SLOT_INTERFACE_START( peribox_slot8 ) |
| r30888 | r30889 | |
| 439 | 442 | SLOT_INTERFACE("tifdc", TI99_FDC) |
| 440 | 443 | SLOT_INTERFACE("bwgleg", TI99_BWG_LEG) |
| 441 | 444 | SLOT_INTERFACE("bwg", TI99_BWG) |
| 442 | | SLOT_INTERFACE("hfdc", TI99_HFDC) |
| 445 | SLOT_INTERFACE("hfdc", TI99_HFDC_LEG) |
| 446 | SLOT_INTERFACE("hfdcnew", TI99_HFDC) |
| 443 | 447 | SLOT_INTERFACE_END |
| 444 | 448 | |
| 445 | 449 | MACHINE_CONFIG_FRAGMENT( peribox_device ) |
| r30888 | r30889 | |
| 463 | 467 | MCFG_DEVICE_ADD(FLOPPY_3, LEGACY_FLOPPY, 0) |
| 464 | 468 | MCFG_DEVICE_CONFIG(ti99_4_floppy_interface) |
| 465 | 469 | MCFG_LEGACY_FLOPPY_IDX_CB(WRITELINE(peribox_device, indexhole)) |
| 466 | | |
| 470 | |
| 467 | 471 | MCFG_MFMHD_3_DRIVES_ADD() |
| 468 | 472 | MACHINE_CONFIG_END |
| 469 | 473 | |
| r30888 | r30889 | |
| 490 | 494 | SLOT_INTERFACE_START( peribox_slot7nobwg ) |
| 491 | 495 | SLOT_INTERFACE("ide", TI99_IDE) |
| 492 | 496 | SLOT_INTERFACE("usbsm", TI99_USBSM) |
| 493 | | SLOT_INTERFACE("hfdc", TI99_HFDC) |
| 497 | SLOT_INTERFACE("hfdc", TI99_HFDC_LEG) |
| 498 | SLOT_INTERFACE("hfdcnew", TI99_HFDC) |
| 494 | 499 | SLOT_INTERFACE_END |
| 495 | 500 | |
| 496 | 501 | SLOT_INTERFACE_START( peribox_slot8nobwg ) |
| 497 | 502 | SLOT_INTERFACE("tifdcleg", TI99_FDC_LEG) |
| 498 | 503 | SLOT_INTERFACE("tifdc", TI99_FDC) |
| 499 | | SLOT_INTERFACE("hfdc", TI99_HFDC) |
| 504 | SLOT_INTERFACE("hfdc", TI99_HFDC_LEG) |
| 505 | SLOT_INTERFACE("hfdcnew", TI99_HFDC) |
| 500 | 506 | SLOT_INTERFACE_END |
| 501 | 507 | |
| 502 | 508 | SLOT_INTERFACE_START( peribox_slotg ) |
| r30888 | r30889 | |
| 527 | 533 | MCFG_DEVICE_ADD(FLOPPY_2, LEGACY_FLOPPY, 0) |
| 528 | 534 | MCFG_DEVICE_CONFIG(ti99_4_floppy_interface) |
| 529 | 535 | MCFG_LEGACY_FLOPPY_IDX_CB(WRITELINE(peribox_device, indexhole)) |
| 530 | | MCFG_DEVICE_ADD(FLOPPY_3, LEGACY_FLOPPY, 0) |
| 536 | MCFG_DEVICE_ADD(FLOPPY_3, LEGACY_FLOPPY, 0) |
| 531 | 537 | MCFG_DEVICE_CONFIG(ti99_4_floppy_interface) |
| 532 | 538 | MCFG_LEGACY_FLOPPY_IDX_CB(WRITELINE(peribox_device, indexhole)) |
| 533 | 539 | MCFG_MFMHD_3_DRIVES_ADD() |
trunk/src/emu/bus/ti99_peb/hfdc.c
| r30888 | r30889 | |
| 15 | 15 | |
| 16 | 16 | February 2012: Rewritten as class |
| 17 | 17 | |
| 18 | June 2014: Rewritten for modern floppy implementation |
| 19 | |
| 20 | WORK IN PROGRESS |
| 21 | |
| 18 | 22 | *****************************************************************************/ |
| 19 | 23 | |
| 24 | #include "emu.h" |
| 25 | #include "peribox.h" |
| 20 | 26 | #include "hfdc.h" |
| 27 | #include "machine/ti99_hd.h" |
| 21 | 28 | #include "imagedev/flopdrv.h" |
| 22 | 29 | #include "formats/ti99_dsk.h" // Format |
| 23 | 30 | |
| r30888 | r30889 | |
| 27 | 34 | |
| 28 | 35 | #define MOTOR_TIMER 1 |
| 29 | 36 | |
| 30 | | #define HFDC_MAX_FLOPPY 4 |
| 31 | | #define HFDC_MAX_HARD 4 |
| 32 | | |
| 33 | 37 | #define TAPE_ADDR 0x0fc0 |
| 34 | 38 | #define HDC_R_ADDR 0x0fd0 |
| 35 | 39 | #define HDC_W_ADDR 0x0fd2 |
| 36 | 40 | #define CLK_ADDR 0x0fe0 |
| 37 | 41 | #define RAM_ADDR 0x1000 |
| 38 | 42 | |
| 39 | | #define VERBOSE 1 |
| 40 | | #define LOG logerror |
| 43 | #define TRACE_EMU 1 |
| 44 | #define TRACE_CRU 1 |
| 41 | 45 | |
| 46 | // ========================================================================= |
| 47 | |
| 48 | /* |
| 49 | Modern implementation. |
| 50 | */ |
| 42 | 51 | myarc_hfdc_device::myarc_hfdc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 43 | 52 | : ti_expansion_card_device(mconfig, TI99_HFDC, "Myarc Hard and Floppy Disk Controller", tag, owner, clock, "ti99_hfdc", __FILE__), |
| 44 | 53 | m_hdc9234(*this, FDC_TAG), |
| r30888 | r30889 | |
| 47 | 56 | } |
| 48 | 57 | |
| 49 | 58 | /* |
| 59 | Read a byte from the memory address space of the HFDC |
| 60 | |
| 61 | 0x4000 - 0x4fbf one of four possible ROM pages |
| 62 | 0x4fc0 - 0x4fcf Tape control (only available in prototype HFDC models) |
| 63 | 0x4fd0 - 0x4fdf HDC 9234 ports |
| 64 | 0x4fe0 - 0x4fff RTC chip ports |
| 65 | |
| 66 | 0x5000 - 0x53ff static RAM page 0x10 |
| 67 | 0x5400 - 0x57ff static RAM page any of 32 pages |
| 68 | 0x5800 - 0x5bff static RAM page any of 32 pages |
| 69 | 0x5c00 - 0x5fff static RAM page any of 32 pages |
| 70 | |
| 71 | HFDC manual, p. 44 |
| 72 | */ |
| 73 | READ8Z_MEMBER(myarc_hfdc_device::readz) |
| 74 | { |
| 75 | if (m_selected && ((offset & m_select_mask)==m_select_value)) |
| 76 | { |
| 77 | logerror("%s: Read access to %04x\n", tag(), offset & 0xffff); |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | /* |
| 82 | Write a byte to the memory address space of the HFDC |
| 83 | |
| 84 | 0x4fc0 - 0x4fcf Tape control (only available in prototype HFDC models) |
| 85 | 0x4fd0 - 0x4fdf HDC 9234 ports |
| 86 | 0x4fe0 - 0x4fff RTC chip ports |
| 87 | |
| 88 | 0x5000 - 0x53ff static RAM page 0x08 |
| 89 | 0x5400 - 0x57ff static RAM page any of 32 pages |
| 90 | 0x5800 - 0x5bff static RAM page any of 32 pages |
| 91 | 0x5c00 - 0x5fff static RAM page any of 32 pages |
| 92 | */ |
| 93 | WRITE8_MEMBER( myarc_hfdc_device::write ) |
| 94 | { |
| 95 | if (m_selected && ((offset & m_select_mask)==m_select_value)) |
| 96 | { |
| 97 | logerror("%s: Write access to %04x: %02x\n", tag(), offset & 0xffff, data); |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | /* |
| 102 | Read a set of 8 bits in the CRU space of the HFDC |
| 103 | There are two banks, according to the state of m_see_switches |
| 104 | |
| 105 | m_see_switches == true: |
| 106 | |
| 107 | 7 6 5 4 3 2 1 0 |
| 108 | +-----+-----+-----+-----+-----+-----+-----+-----+ |
| 109 | |DIP1*|DIP2*|DIP3*|DIP4*|DIP5*|DIP6*|DIP7*|DIP8*| |
| 110 | +-----+-----+-----+-----+-----+-----+-----+-----+ |
| 111 | |
| 112 | MZ: The setting 00 (all switches on) is a valid setting according to the |
| 113 | HFDC manual and indicates 36 sectors/track, 80 tracks; however, this |
| 114 | setting is intended "for possible future expansion" and cannot fall |
| 115 | back to lower formats, hence, single density disks cannot be read. |
| 116 | --- |
| 117 | |
| 118 | m_see_switches == false: |
| 119 | |
| 120 | 7 6 5 4 3 2 1 0 |
| 121 | +-----+-----+-----+-----+-----+-----+-----+-----+ |
| 122 | | 0 | 0 | 0 | 0 | 0 | MON | DIP | IRQ | |
| 123 | +-----+-----+-----+-----+-----+-----+-----+-----+ |
| 124 | |
| 125 | MON = Motor on |
| 126 | DIP = DMA in progress |
| 127 | IRQ = Interrupt request |
| 128 | --- |
| 129 | 0 on all other locations |
| 130 | */ |
| 131 | READ8Z_MEMBER(myarc_hfdc_device::crureadz) |
| 132 | { |
| 133 | if ((offset & 0xff00)==m_cru_base) |
| 134 | { |
| 135 | if (TRACE_CRU) logerror("%s: CRU read access to %04x\n", tag(), offset & 0xffff); |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | /* |
| 140 | Set a bit in the CRU space of the HFDC |
| 141 | |
| 142 | 7 6 5 4 3 2 1 0 |
| 143 | +-----+-----+-----+-----+-----+-----+-----+-----+ |
| 144 | | 0 | MON | DIP | ROM1| ROM0| MON | RES | SEL | |
| 145 | | | | | CSEL| CD1 | CD0 | | | |
| 146 | +-----+-----+-----+-----+-----+-----+-----+-----+ |
| 147 | |
| 148 | 17 16 15 14 13 12 11 10 F E D C B A 9 8 |
| 149 | +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+ |
| 150 | | RAM page select @5C00 | RAM page select @5800 | RAM page select @5400 | - | |
| 151 | +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+ |
| 152 | |
| 153 | SEL = Select card (and map ROM into address space) |
| 154 | RES = Reset controller |
| 155 | MON = Motor on |
| 156 | ROM bank select: bank 0..3; bit 3 = MSB, 4 = LSB |
| 157 | RAM bank select: bank 0..31; bit 9 = LSB (accordingly for other two areas) |
| 158 | CD0 and CD1 are Clock Divider selections for the Floppy Data Separator (FDC9216) |
| 159 | CSEL = cru_select |
| 160 | |
| 161 | HFDC manual p. 43 |
| 162 | */ |
| 163 | WRITE8_MEMBER(myarc_hfdc_device::cruwrite) |
| 164 | { |
| 165 | if ((offset & 0xff00)==m_cru_base) |
| 166 | { |
| 167 | if (TRACE_CRU) logerror("%s: CRU write access to %04x: %d\n", tag(), offset & 0xffff, data); |
| 168 | |
| 169 | int bit = (offset >> 1) & 0x1f; |
| 170 | |
| 171 | // Handle the page selects right here |
| 172 | if (bit >= 0x09 && bit < 0x18) |
| 173 | { |
| 174 | if (data) |
| 175 | // we leave index 0 unchanged; modify indices 1-3 |
| 176 | m_ram_page[(bit-4)/5] |= 1 << ((bit-9)%5); |
| 177 | else |
| 178 | m_ram_page[(bit-4)/5] &= ~(1 << ((bit-9)%5)); |
| 179 | return; |
| 180 | } |
| 181 | |
| 182 | switch (bit) |
| 183 | { |
| 184 | case 0: |
| 185 | m_selected = (data!=0); |
| 186 | if (TRACE_CRU) logerror("%s: selected = %d\n", tag(), m_selected); |
| 187 | break; |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | /* |
| 193 | Called whenever the state of the HDC9234 interrupt pin changes. |
| 194 | */ |
| 195 | WRITE_LINE_MEMBER( myarc_hfdc_device::intrq_w ) |
| 196 | { |
| 197 | m_irq = state; |
| 198 | |
| 199 | // Set INTA* |
| 200 | // Signal from SMC is active high, INTA* is active low; board inverts signal |
| 201 | // Anyway, we keep with ASSERT_LINE and CLEAR_LINE |
| 202 | m_slot->set_inta(state); |
| 203 | } |
| 204 | |
| 205 | /* |
| 206 | Called whenever the state of the HDC9234 DMA in progress changes. |
| 207 | */ |
| 208 | WRITE_LINE_MEMBER( myarc_hfdc_device::dip_w ) |
| 209 | { |
| 210 | m_dip = state; |
| 211 | } |
| 212 | |
| 213 | WRITE8_MEMBER( myarc_hfdc_device::auxbus_out ) |
| 214 | { |
| 215 | logerror("%s: Write access to auxbus at %04x: %02x\n", tag(), offset & 0xffff, data); |
| 216 | } |
| 217 | |
| 218 | READ8_MEMBER( myarc_hfdc_device::auxbus_in ) |
| 219 | { |
| 220 | logerror("%s: Read access to auxbus at %04x\n", tag(), offset & 0xffff); |
| 221 | return 0; |
| 222 | } |
| 223 | |
| 224 | /* |
| 225 | Read a byte from the onboard SRAM |
| 226 | */ |
| 227 | READ8_MEMBER( myarc_hfdc_device::read_buffer ) |
| 228 | { |
| 229 | logerror("%s: Read access to onboard SRAM at %04x\n", tag(), offset & 0xffff); |
| 230 | return 0; |
| 231 | } |
| 232 | |
| 233 | /* |
| 234 | Write a byte to the onboard SRAM |
| 235 | */ |
| 236 | WRITE8_MEMBER( myarc_hfdc_device::write_buffer ) |
| 237 | { |
| 238 | logerror("%s: Write access to onboard SRAM at %04x: %02x\n", tag(), offset & 0xffff, data); |
| 239 | } |
| 240 | |
| 241 | void myarc_hfdc_device::device_start() |
| 242 | { |
| 243 | if (TRACE_EMU) logerror("%s: start\n", tag()); |
| 244 | m_dsrrom = memregion(DSRROM)->base(); |
| 245 | m_buffer_ram = memregion(BUFFER)->base(); |
| 246 | m_motor_on_timer = timer_alloc(MOTOR_TIMER); |
| 247 | // The HFDC does not use READY; it has on-board RAM for DMA |
| 248 | } |
| 249 | |
| 250 | void myarc_hfdc_device::device_reset() |
| 251 | { |
| 252 | if (TRACE_EMU) logerror("%s: reset\n", tag()); |
| 253 | |
| 254 | // The GenMOD mod; our implementation automagically adapts all cards |
| 255 | if (m_genmod) |
| 256 | { |
| 257 | m_select_mask = 0x1fe000; |
| 258 | m_select_value = 0x174000; |
| 259 | } |
| 260 | else |
| 261 | { |
| 262 | m_select_mask = 0x7e000; |
| 263 | m_select_value = 0x74000; |
| 264 | } |
| 265 | |
| 266 | m_cru_base = ioport("CRUHFDC")->read(); |
| 267 | |
| 268 | // Resetting values |
| 269 | m_rom_page = 0; |
| 270 | |
| 271 | m_ram_page[0] = 0x08; // static page 0x08 |
| 272 | for (int i=1; i < 4; i++) m_ram_page[i] = 0; |
| 273 | |
| 274 | m_output1_latch = m_output2_latch = 0; |
| 275 | m_dip = m_irq = false; |
| 276 | m_see_switches = false; |
| 277 | m_CD = 0; |
| 278 | m_motor_running = false; |
| 279 | m_selected = false; |
| 280 | } |
| 281 | |
| 282 | INPUT_PORTS_START( ti99_hfdc ) |
| 283 | PORT_START( "CRUHFDC" ) |
| 284 | PORT_DIPNAME( 0x1f00, 0x1100, "HFDC CRU base" ) |
| 285 | PORT_DIPSETTING( 0x1000, "1000" ) |
| 286 | PORT_DIPSETTING( 0x1100, "1100" ) |
| 287 | PORT_DIPSETTING( 0x1200, "1200" ) |
| 288 | PORT_DIPSETTING( 0x1300, "1300" ) |
| 289 | PORT_DIPSETTING( 0x1400, "1400" ) |
| 290 | PORT_DIPSETTING( 0x1500, "1500" ) |
| 291 | PORT_DIPSETTING( 0x1600, "1600" ) |
| 292 | PORT_DIPSETTING( 0x1700, "1700" ) |
| 293 | PORT_DIPSETTING( 0x1800, "1800" ) |
| 294 | PORT_DIPSETTING( 0x1900, "1900" ) |
| 295 | PORT_DIPSETTING( 0x1a00, "1A00" ) |
| 296 | PORT_DIPSETTING( 0x1b00, "1B00" ) |
| 297 | PORT_DIPSETTING( 0x1c00, "1C00" ) |
| 298 | PORT_DIPSETTING( 0x1d00, "1D00" ) |
| 299 | PORT_DIPSETTING( 0x1e00, "1E00" ) |
| 300 | PORT_DIPSETTING( 0x1f00, "1F00" ) |
| 301 | |
| 302 | PORT_START( "HFDCDIP" ) |
| 303 | PORT_DIPNAME( 0xff, 0x55, "HFDC drive config" ) |
| 304 | PORT_DIPSETTING( 0x00, "40 track, 16 ms") |
| 305 | PORT_DIPSETTING( 0xaa, "40 track, 8 ms") |
| 306 | PORT_DIPSETTING( 0x55, "80 track, 2 ms") |
| 307 | PORT_DIPSETTING( 0xff, "80 track HD, 2 ms") |
| 308 | INPUT_PORTS_END |
| 309 | |
| 310 | MACHINE_CONFIG_FRAGMENT( ti99_hfdc ) |
| 311 | MCFG_DEVICE_ADD(FDC_TAG, HDC9234, 0) |
| 312 | MCFG_HDC9234_INTRQ_CALLBACK(WRITELINE(myarc_hfdc_device, intrq_w)) |
| 313 | MCFG_HDC9234_DIP_CALLBACK(WRITELINE(myarc_hfdc_device, dip_w)) |
| 314 | MCFG_HDC9234_AUXBUS_OUT_CALLBACK(WRITE8(myarc_hfdc_device, auxbus_out)) |
| 315 | MCFG_HDC9234_AUXBUS_IN_CALLBACK(READ8(myarc_hfdc_device, auxbus_in)) |
| 316 | MCFG_HDC9234_DMA_IN_CALLBACK(READ8(myarc_hfdc_device, read_buffer)) |
| 317 | MCFG_HDC9234_DMA_OUT_CALLBACK(WRITE8(myarc_hfdc_device, write_buffer)) |
| 318 | |
| 319 | MCFG_DEVICE_ADD(CLOCK_TAG, MM58274C, 0) |
| 320 | MCFG_MM58274C_MODE24(1) // 24 hour |
| 321 | MCFG_MM58274C_DAY1(0) // sunday |
| 322 | MACHINE_CONFIG_END |
| 323 | |
| 324 | ROM_START( ti99_hfdc ) |
| 325 | ROM_REGION(0x4000, DSRROM, 0) |
| 326 | ROM_LOAD("hfdc.bin", 0x0000, 0x4000, CRC(66fbe0ed) SHA1(11df2ecef51de6f543e4eaf8b2529d3e65d0bd59)) /* HFDC disk DSR ROM */ |
| 327 | ROM_REGION(0x8000, BUFFER, 0) /* HFDC RAM buffer 32 KiB */ |
| 328 | ROM_FILL(0x0000, 0x8000, 0x00) |
| 329 | ROM_END |
| 330 | |
| 331 | |
| 332 | machine_config_constructor myarc_hfdc_device::device_mconfig_additions() const |
| 333 | { |
| 334 | return MACHINE_CONFIG_NAME( ti99_hfdc ); |
| 335 | } |
| 336 | |
| 337 | const rom_entry *myarc_hfdc_device::device_rom_region() const |
| 338 | { |
| 339 | return ROM_NAME( ti99_hfdc ); |
| 340 | } |
| 341 | |
| 342 | ioport_constructor myarc_hfdc_device::device_input_ports() const |
| 343 | { |
| 344 | return INPUT_PORTS_NAME( ti99_hfdc ); |
| 345 | } |
| 346 | |
| 347 | const device_type TI99_HFDC = &device_creator<myarc_hfdc_device>; |
| 348 | |
| 349 | // ========================================================================= |
| 350 | |
| 351 | /* |
| 352 | Legacy implementation. |
| 353 | */ |
| 354 | #define VERBOSE 1 |
| 355 | #define LOG logerror |
| 356 | |
| 357 | myarc_hfdc_legacy_device::myarc_hfdc_legacy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 358 | : ti_expansion_card_device(mconfig, TI99_HFDC_LEG, "Myarc Hard and Floppy Disk Controller LEGACY", tag, owner, clock, "ti99_hfdc", __FILE__), |
| 359 | m_hdc9234(*this, FDC_TAG), |
| 360 | m_clock(*this, CLOCK_TAG) |
| 361 | { |
| 362 | } |
| 363 | |
| 364 | /* |
| 50 | 365 | read a byte in disk DSR space |
| 51 | 366 | HFDC manual, p. 44 |
| 52 | 367 | Memory map as seen by the 99/4A PEB |
| r30888 | r30889 | |
| 61 | 376 | 0x5800 - 0x5bff static RAM page any of 32 pages |
| 62 | 377 | 0x5c00 - 0x5fff static RAM page any of 32 pages |
| 63 | 378 | */ |
| 64 | | READ8Z_MEMBER(myarc_hfdc_device::readz) |
| 379 | READ8Z_MEMBER(myarc_hfdc_legacy_device::readz) |
| 65 | 380 | { |
| 66 | 381 | if (m_selected && ((offset & m_select_mask)==m_select_value)) |
| 67 | 382 | { |
| r30888 | r30889 | |
| 119 | 434 | /* |
| 120 | 435 | Write a byte to the controller. |
| 121 | 436 | */ |
| 122 | | WRITE8_MEMBER( myarc_hfdc_device::write ) |
| 437 | WRITE8_MEMBER( myarc_hfdc_legacy_device::write ) |
| 123 | 438 | { |
| 124 | 439 | if (m_selected && ((offset & m_select_mask)==m_select_value)) |
| 125 | 440 | { |
| r30888 | r30889 | |
| 160 | 475 | } |
| 161 | 476 | } |
| 162 | 477 | |
| 163 | | READ8Z_MEMBER(myarc_hfdc_device::crureadz) |
| 478 | READ8Z_MEMBER(myarc_hfdc_legacy_device::crureadz) |
| 164 | 479 | { |
| 165 | 480 | UINT8 reply; |
| 166 | 481 | if ((offset & 0xff00)==m_cru_base) |
| r30888 | r30889 | |
| 213 | 528 | Bit number = (CRU_rel_address - base_address)/2 |
| 214 | 529 | CD0 and CD1 are Clock Divider selections for the Floppy Data Separator (FDC9216) |
| 215 | 530 | */ |
| 216 | | WRITE8_MEMBER(myarc_hfdc_device::cruwrite) |
| 531 | WRITE8_MEMBER(myarc_hfdc_legacy_device::cruwrite) |
| 217 | 532 | { |
| 218 | 533 | if ((offset & 0xff00)==m_cru_base) |
| 219 | 534 | { |
| r30888 | r30889 | |
| 273 | 588 | } |
| 274 | 589 | |
| 275 | 590 | |
| 276 | | int myarc_hfdc_device::slog2(int value) |
| 591 | int myarc_hfdc_legacy_device::slog2(int value) |
| 277 | 592 | { |
| 278 | 593 | int i=-1; |
| 279 | 594 | while (value!=0) |
| r30888 | r30889 | |
| 284 | 599 | return i; |
| 285 | 600 | } |
| 286 | 601 | |
| 287 | | READ8_MEMBER( myarc_hfdc_device::auxbus_in ) |
| 602 | READ8_MEMBER( myarc_hfdc_legacy_device::auxbus_in ) |
| 288 | 603 | { |
| 289 | 604 | UINT8 reply = 0; |
| 290 | 605 | int index = 0; |
| r30888 | r30889 | |
| 335 | 650 | return reply; |
| 336 | 651 | } |
| 337 | 652 | |
| 338 | | WRITE8_MEMBER( myarc_hfdc_device::auxbus_out ) |
| 653 | WRITE8_MEMBER( myarc_hfdc_legacy_device::auxbus_out ) |
| 339 | 654 | { |
| 340 | 655 | int index; |
| 341 | 656 | switch (offset) |
| r30888 | r30889 | |
| 383 | 698 | /* |
| 384 | 699 | Read a byte from buffer in DMA mode |
| 385 | 700 | */ |
| 386 | | READ8_MEMBER( myarc_hfdc_device::read_buffer ) |
| 701 | READ8_MEMBER( myarc_hfdc_legacy_device::read_buffer ) |
| 387 | 702 | { |
| 388 | 703 | UINT8 value = m_buffer_ram[m_dma_address & 0x7fff]; |
| 389 | 704 | m_dma_address++; |
| r30888 | r30889 | |
| 393 | 708 | /* |
| 394 | 709 | Write a byte to buffer in DMA mode |
| 395 | 710 | */ |
| 396 | | WRITE8_MEMBER( myarc_hfdc_device::write_buffer ) |
| 711 | WRITE8_MEMBER( myarc_hfdc_legacy_device::write_buffer ) |
| 397 | 712 | { |
| 398 | 713 | m_buffer_ram[m_dma_address & 0x7fff] = data; |
| 399 | 714 | m_dma_address++; |
| r30888 | r30889 | |
| 402 | 717 | /* |
| 403 | 718 | Called whenever the state of the sms9234 interrupt pin changes. |
| 404 | 719 | */ |
| 405 | | WRITE_LINE_MEMBER( myarc_hfdc_device::intrq_w ) |
| 720 | WRITE_LINE_MEMBER( myarc_hfdc_legacy_device::intrq_w ) |
| 406 | 721 | { |
| 407 | 722 | m_irq = state; |
| 408 | 723 | |
| r30888 | r30889 | |
| 412 | 727 | m_slot->set_inta(state); |
| 413 | 728 | } |
| 414 | 729 | |
| 415 | | |
| 416 | 730 | /* |
| 417 | 731 | Called whenever the state of the sms9234 DMA in progress changes. |
| 418 | 732 | */ |
| 419 | | WRITE_LINE_MEMBER( myarc_hfdc_device::dip_w ) |
| 733 | WRITE_LINE_MEMBER( myarc_hfdc_legacy_device::dip_w ) |
| 420 | 734 | { |
| 421 | 735 | m_dip = state; |
| 422 | 736 | } |
| r30888 | r30889 | |
| 424 | 738 | /* |
| 425 | 739 | Callback called at the end of DVENA pulse |
| 426 | 740 | */ |
| 427 | | void myarc_hfdc_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 741 | void myarc_hfdc_legacy_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 428 | 742 | { |
| 429 | 743 | m_motor_running = false; |
| 430 | 744 | if (VERBOSE>6) LOG("hfdc: motor off\n"); |
| 431 | 745 | } |
| 432 | 746 | |
| 433 | | MACHINE_CONFIG_FRAGMENT( ti99_hfdc ) |
| 747 | MACHINE_CONFIG_FRAGMENT( ti99_hfdc_legacy ) |
| 434 | 748 | MCFG_DEVICE_ADD(FDC_TAG, SMC92X4, 0) |
| 435 | | MCFG_SMC92X4_INTRQ_CALLBACK(WRITELINE(myarc_hfdc_device, intrq_w)) |
| 436 | | MCFG_SMC92X4_DIP_CALLBACK(WRITELINE(myarc_hfdc_device, dip_w)) |
| 437 | | MCFG_SMC92X4_AUXBUS_OUT_CALLBACK(WRITE8(myarc_hfdc_device, auxbus_out)) |
| 438 | | MCFG_SMC92X4_AUXBUS_IN_CALLBACK(READ8(myarc_hfdc_device, auxbus_in)) |
| 439 | | MCFG_SMC92X4_DMA_IN_CALLBACK(READ8(myarc_hfdc_device, read_buffer)) |
| 440 | | MCFG_SMC92X4_DMA_OUT_CALLBACK(WRITE8(myarc_hfdc_device, write_buffer)) |
| 749 | MCFG_SMC92X4_INTRQ_CALLBACK(WRITELINE(myarc_hfdc_legacy_device, intrq_w)) |
| 750 | MCFG_SMC92X4_DIP_CALLBACK(WRITELINE(myarc_hfdc_legacy_device, dip_w)) |
| 751 | MCFG_SMC92X4_AUXBUS_OUT_CALLBACK(WRITE8(myarc_hfdc_legacy_device, auxbus_out)) |
| 752 | MCFG_SMC92X4_AUXBUS_IN_CALLBACK(READ8(myarc_hfdc_legacy_device, auxbus_in)) |
| 753 | MCFG_SMC92X4_DMA_IN_CALLBACK(READ8(myarc_hfdc_legacy_device, read_buffer)) |
| 754 | MCFG_SMC92X4_DMA_OUT_CALLBACK(WRITE8(myarc_hfdc_legacy_device, write_buffer)) |
| 441 | 755 | MCFG_SMC92X4_FULL_TRACK_LAYOUT(FALSE) /* do not use the full track layout */ |
| 442 | 756 | |
| 443 | 757 | MCFG_DEVICE_ADD(CLOCK_TAG, MM58274C, 0) |
| r30888 | r30889 | |
| 445 | 759 | MCFG_MM58274C_DAY1(0) // sunday |
| 446 | 760 | MACHINE_CONFIG_END |
| 447 | 761 | |
| 448 | | ROM_START( ti99_hfdc ) |
| 762 | ROM_START( ti99_hfdc_legacy ) |
| 449 | 763 | ROM_REGION(0x4000, DSRROM, 0) |
| 450 | 764 | ROM_LOAD("hfdc.bin", 0x0000, 0x4000, CRC(66fbe0ed) SHA1(11df2ecef51de6f543e4eaf8b2529d3e65d0bd59)) /* HFDC disk DSR ROM */ |
| 451 | 765 | ROM_REGION(0x8000, BUFFER, 0) /* HFDC RAM buffer 32 KiB */ |
| 452 | 766 | ROM_FILL(0x0000, 0x8000, 0x00) |
| 453 | 767 | ROM_END |
| 454 | 768 | |
| 455 | | INPUT_PORTS_START( ti99_hfdc ) |
| 769 | INPUT_PORTS_START( ti99_hfdc_legacy ) |
| 456 | 770 | PORT_START( "CRUHFDC" ) |
| 457 | 771 | PORT_DIPNAME( 0x1f00, 0x1100, "HFDC CRU base" ) |
| 458 | 772 | PORT_DIPSETTING( 0x1000, "1000" ) |
| r30888 | r30889 | |
| 485 | 799 | PORT_CONFSETTING( 0x01, "Realistic") |
| 486 | 800 | INPUT_PORTS_END |
| 487 | 801 | |
| 488 | | void myarc_hfdc_device::device_start() |
| 802 | void myarc_hfdc_legacy_device::device_start() |
| 489 | 803 | { |
| 490 | 804 | if (VERBOSE>5) LOG("hfdc: start\n"); |
| 491 | 805 | m_dsrrom = memregion(DSRROM)->base(); |
| r30888 | r30889 | |
| 496 | 810 | // The HFDC does not use READY; it has on-board RAM for DMA |
| 497 | 811 | } |
| 498 | 812 | |
| 499 | | void myarc_hfdc_device::device_reset() |
| 813 | void myarc_hfdc_legacy_device::device_reset() |
| 500 | 814 | { |
| 501 | 815 | if (VERBOSE>5) LOG("hfdc: reset\n"); |
| 502 | 816 | if (m_genmod) |
| r30888 | r30889 | |
| 558 | 872 | // TODO: Check how to make use of floppy_mon_w(w->drive, CLEAR_LINE); |
| 559 | 873 | } |
| 560 | 874 | |
| 561 | | machine_config_constructor myarc_hfdc_device::device_mconfig_additions() const |
| 875 | machine_config_constructor myarc_hfdc_legacy_device::device_mconfig_additions() const |
| 562 | 876 | { |
| 563 | | return MACHINE_CONFIG_NAME( ti99_hfdc ); |
| 877 | return MACHINE_CONFIG_NAME( ti99_hfdc_legacy ); |
| 564 | 878 | } |
| 565 | 879 | |
| 566 | | const rom_entry *myarc_hfdc_device::device_rom_region() const |
| 880 | const rom_entry *myarc_hfdc_legacy_device::device_rom_region() const |
| 567 | 881 | { |
| 568 | | return ROM_NAME( ti99_hfdc ); |
| 882 | return ROM_NAME( ti99_hfdc_legacy ); |
| 569 | 883 | } |
| 570 | 884 | |
| 571 | | ioport_constructor myarc_hfdc_device::device_input_ports() const |
| 885 | ioport_constructor myarc_hfdc_legacy_device::device_input_ports() const |
| 572 | 886 | { |
| 573 | | return INPUT_PORTS_NAME(ti99_hfdc); |
| 887 | return INPUT_PORTS_NAME(ti99_hfdc_legacy); |
| 574 | 888 | } |
| 575 | 889 | |
| 576 | | const device_type TI99_HFDC = &device_creator<myarc_hfdc_device>; |
| 890 | const device_type TI99_HFDC_LEG = &device_creator<myarc_hfdc_legacy_device>; |